Commit Graph

9975 Commits

Author SHA1 Message Date
Niko Matsakis
30b47649ea new liveness pass to supercede last_use / initedness 2012-05-24 09:52:03 -07:00
Niko Matsakis
a3be0b1054 fix classes and parameterized ifaces; remove needless self check
ref #1726, #2434
2012-05-24 06:49:40 -07:00
Niko Matsakis
bd573becf5 change region scope of call arguments, old one was unsound
improve error message to describe kind of deref'd ptr using sigil
2012-05-24 05:19:44 -07:00
Niko Matsakis
c9eb9ee612 rewrite purity check to search through scope chain 2012-05-24 05:19:44 -07:00
Niko Matsakis
6ca6a3b80b rewrite arc to use region & expressions (also making it pass borrowck) 2012-05-24 05:19:44 -07:00
Brian Anderson
4fec4cd8f5 bench: Add hard mode to benchmarks. Activate with RUST_BENCH.
RUST_BENCH is on automatically when running `make perf`
2012-05-23 22:55:41 -07:00
Brian Anderson
2f3cff2806 bench: Remove 99bob benchmarks 2012-05-23 20:29:46 -07:00
Niko Matsakis
58988c3565 changes to get std passing borrowck 2012-05-23 17:25:56 -07:00
Paul Stansifer
4c2bf8e4a7 The parser is represented by a class now. 2012-05-23 16:23:11 -07:00
Paul Stansifer
a16cb376ac Update reserved words for syntax highlighters (vim is still behind, though) 2012-05-23 16:23:11 -07:00
Eric Holk
5f154770e2 Prevent capturing non-copyable things in closures. 2012-05-23 15:46:43 -07:00
Eric Holk
6fa1a084f7 A shareable atomically reference counted pointer wrapper.
Needs more tests to ensure safety, and probably some more work on usability too.
2012-05-23 14:58:16 -07:00
Niko Matsakis
9773a22119 shuffle error messages in borrowck, and prevent it from spewing too many
also, fix a few minor issues it complains about
2012-05-23 12:01:27 -07:00
Brian Anderson
248f8826a9 bench: Reduce constants in std-smallintmap to make it valgrind fast 2012-05-23 11:24:02 -07:00
Michael Sullivan
353cda5c86 Update the tutorial with the new shift behaviors. 2012-05-23 11:00:33 -07:00
Eric Holk
8678baab12 Resources are once again not copyable. 2012-05-23 10:27:42 -07:00
Lindsey Kuper
9f1a197c2a M-x sort-lines 2012-05-23 10:25:42 -07:00
Lindsey Kuper
9460f65d97 Add Margaret to AUTHORS. 2012-05-23 10:22:16 -07:00
Niko Matsakis
b93839408c new test 2012-05-23 06:30:29 -07:00
Niko Matsakis
e0f59e835e modify borrowck to allow arbitrary borrows in pure scopes 2012-05-23 06:30:29 -07:00
Niko Matsakis
00849191ce refactor loan to not return result<> 2012-05-23 06:30:29 -07:00
Niko Matsakis
01a2e99639 prepare for gather to gather up multiple maps 2012-05-23 06:30:29 -07:00
Brian Anderson
d2ec15bcf1 rustc: Eliminate metadata's dependency on util::common 2012-05-23 00:57:07 -07:00
Brian Anderson
f9d0cde19a syntax: Remove one of the two def_id hashers 2012-05-23 00:45:18 -07:00
Brian Anderson
4756556748 rustc: Move new_def_hash to ast_util 2012-05-23 00:43:02 -07:00
Brian Anderson
8ec467d521 std: Update timer for new kind rules 2012-05-22 22:29:17 -07:00
Jeff Olson
92e9e736fa std: high-level libuv-leverage APIs now take a hl_loop as arg (tcp/timer) 2012-05-22 22:29:17 -07:00
Jeff Olson
b0b175214a std: more work on uv tests to endure valgrind's machinations against them
- change port of tcp server test in uv_ll to avoid conflict w/ test in
net::tcp
- a few places the tcp::read fn is used in test w/ a timeout.. suspend
use of the timeout from here on out.
2012-05-22 22:29:17 -07:00
Jeff Olson
c7656f67ad std:: adding tcp::read fn as simple, blocking read operation, akin to write
also: read_future ala write_future .. woooooohooooooooo
2012-05-22 22:29:17 -07:00
Jeff Olson
c2ae062e90 std: adding tcp::write_future for non-block tcp writes, docs cleanup 2012-05-22 22:29:17 -07:00
Jeff Olson
9b10359041 std: several minor cleanups wrt codereview.. see extended comments
* there are a few places where I was experimenting w/ using `alt` in places
where `if`/`else` would've sufficed. don't drink the koolaid!
* I had an unneeded `else` structure (the `if` branch that preceeded
concluded with a `fail` statement.. I added the `fail` later in the dev
cycle for this branch, so I forgot to remove the `else` after doing so)
* consistent wrt `prop_name: value` vs. `prop_name : value` in record decl
and initialization
* change an `alt` exp on an `ip_addr` to actually be exhaustive,
instead of using a catch-all clause
2012-05-22 22:29:17 -07:00
Jeff Olson
7de1a68217 std: add try_parse_addr and change an alt w/ ip_addr::ipv6 to avoid warning 2012-05-22 22:29:17 -07:00
Jeff Olson
bb88f772a4 core: doc/err feedback tweeks for result::unwrap 2012-05-22 22:29:17 -07:00
Jeff Olson
a40f550ed5 std: more docs and some methods for types in net::tcp 2012-05-22 22:29:17 -07:00
Jeff Olson
a4b1e965e2 std: ignoring timer test that seems to be race-failing b/c valgrind
.. this test fails frequently, locally, when ran with the batch of other
global_loop tests running due to how valgrind deals with multithreading
in the test app. not sure what to do, here.
2012-05-22 22:29:17 -07:00
Jeff Olson
6c6a47bf22 std: splitting out tcp server API + tests
- we now have two interfaces for the TCP/IP server/listener workflow,
based on different user approaches surrounding how to deal with the
flow of accept a new tcp connection:

1. the "original" API closely mimics the low-level libuv API, in that we
have an on_connect_cb that the user provides *that is ran on the libuv
thread*. In this callback, the user can accept() a connection, turning it
into a tcp_socket.. of course, before accepting, they have the option
of passing it to a new task, provided they *make the cb block until
the accept is done* .. this is because, in libuv, you have to do the
uv_accept call in the span of that on_connect_cb callback that gets fired
when a new connection comes in. thems the breaks..

I wanted to just get rid of this API, because the general proposition of
users always running code on the libuv thread sounds like an invitation
for many future headaches. the API restriction to have to choose to
immediately accept a connection (and allow the user to block libuv as
needed) isn't too bad for power users who could conceive of circumstances
where they would drop an incoming TCP connection and know what they're
doing, in general.

but as a general API, I thought this was a bit cumbersome, so I ended up
devising..

2. an API that is initiated with a call to `net::tcp::new_listener()` ..
has a similar signature to `net::tcp::listen()`, except that is just
returns an object that sort of behaves like a `comm::port`. Users can
block on the `tcp_conn_port` to receive new connections, either in the
current task or in a new task, depending on which API route they take
(`net::tcp::conn_recv` or `net::tcp::conn_recv_spawn` respectively).. there
is also a `net::tcp::conn_peek` function that will do a peek on the
underlying port to see if there are pending connections.

The main difference, with this API, is that the low-level libuv glue is
going to *accept every connection attempt*, along with the overhead that
that brings. But, this is a much more hassle-free API for 95% of use
cases and will probably be the one that most users will want to reach for.
2012-05-22 22:29:17 -07:00
Jeff Olson
e9c6416df6 std: splitting out tcp server API WIP 2012-05-22 22:29:17 -07:00
Jeff Olson
d02b3dffa4 std: reworking how some net and libuv modules are exported in the rc
.. turns out that, without the export, the modules aren't accessible
outside of the crate, itself. I thought that, by importing some module
into another (nesting it) and exporting from that nested module (which
is, itself, exported from std.rc) that my mod would be in the build
artifact. This doesn't appear to be the case. learning is fun!
2012-05-22 22:29:17 -07:00
Jeff Olson
8769409612 rt: adding rust_uv_* binding for kernel malloc and free'ing :/
I need these in the context of doing various malloc/free operations for
libuv structs that need to live in the heap, because of API workflow
(there's no stack to put them in). This has cropped up several times
when impl'ing the high-level API for things like timers, but I've decided
to take the plunge and use this approach for the net::tcp module.

Technically, this can be avoided by spawning a new
task that contains the needed memory structures on its stack and then
having it block for the duration of the time we need that memory to be
valid (this is what I did in std::timer). Exposing this API provides a
much lower overhead way to address
the issue, albeit with safety concerns. The main mitigation policy should
be to use malloc/free with libuv handles only when the handles, are then
associated with a resource or class-with-dtor. So we have a finite lifetime
for the object and can gaurantee a free(), barring a runtime crash (in
which case you have bigger problems!)
2012-05-22 22:29:16 -07:00
Jeff Olson
733881d852 std: tightening up net::tcp, server/client test done, still has races..
.. going to rework the listen() API to be non-blocking.
2012-05-22 22:29:16 -07:00
Jeff Olson
a4127d3fc6 std: change sig of uv::ll::accept, again. 2012-05-22 22:29:16 -07:00
Jeff Olson
465412aeff std: first-pass at a tcp server API, with a basic (non-robust) test
also whitespace cleanup

.. for now, the test just spins up the server and listens for messages,
echoing them back to an output port. there's a "kill" msg that it will
listen for. need to point the tcp client and server test impls at each
other for a loopback server/client test, like how its done in uv::ll

once ipv6 parse/format lands, i can add another test using the entirely
same codebase, but substituting an ip_addr ipv6 varient for the ipv4
varient used in the existing code

still need some other plumbing to get the client/server tests to work
together.
2012-05-22 22:29:16 -07:00
Jeff Olson
f2fd3bcf17 std: FIXME stub net::ip::ip_addr::ipv6 variant...needs parse/format impl
still need implementation for parsing/output formatting and (perhaps?)
representation (for now, i just followef the ipv4 variant's lead and
am representing it as a tuple of 8x u16).

parsing an ipv6 addr is way more complex than parsing an ipv4 addr, so
i'm putting off an implementation here, for now.

candidate solutions:
- could use getaddrinfo() (exists on both POSIX and windows), but with
incompatible fn signatures.
- libuv has a way to parse an ipv6 string into
a sockaddr_in6, but it also requires a port, so it's probably not aprop
for ip_addr
2012-05-22 22:29:16 -07:00
Jeff Olson
64048d43d6 std: makeing uv::ll::listen/accept use generic params for ptr args
more flexibility..
2012-05-22 22:29:16 -07:00
Jeff Olson
83cca50240 std: change tcp_*_result to use result::result.. flatter! 2012-05-22 22:29:16 -07:00
Jeff Olson
082a95a077 core: add result::unwrap() .. patch from @nmatsakis 2012-05-22 22:29:16 -07:00
Jeff Olson
3d8f7d644b std: no longer return uv::ll::err_data records from net::tcp
they're changed into a net::tcp::tcp_err_data record, for now. once the
scope of possible tcp errors, from libuv, is established ill create an
err type for each one and return those where they might occur
2012-05-22 22:29:16 -07:00
Jeff Olson
565c5d694a std: impl for high-level tcp client/request workflow 2012-05-22 22:29:16 -07:00
Jeff Olson
7e114b200a std: impl of net::tcp::write and make net::tcp::tcp_socket a resource 2012-05-22 22:29:16 -07:00
Jeff Olson
5590dfc857 std: tweak uv::ll::write signature and make it generic/more flexible 2012-05-22 22:29:16 -07:00