Commit Graph

537 Commits

Author SHA1 Message Date
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
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
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
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
Jeff Olson
550b34b782 std: impl for net::tcp::connect 2012-05-22 22:29:15 -07:00
Jeff Olson
bc846ce7e3 std: export net::ip::format_addr 2012-05-22 22:29:15 -07:00
Jeff Olson
08b3048c43 std: misc cleanup for uv::ll
* tweaked the layout of sockaddr_in6 struct in anticipation of future use
* changed several uv:ll fn signatures to use generics and be more flexible
with ptr types they get passed
* add uv_err_data and a help fn to return it.. packages up err_name and
err_msg info from uv_get_last_error() stuff..
2012-05-22 22:29:15 -07:00
Jeff Olson
d99b7bcb2f std: pushing existing code in net.rs -> net_ip.rs and re-import/exporting 2012-05-22 22:29:15 -07:00
Jeff Olson
ffdaf14dd9 initial stab at API for std::net::tcp 2012-05-22 22:29:15 -07:00
Eric Holk
24431520bf Removing par.rs, since it's not usable now anyway. 2012-05-22 15:31:39 -07:00
Eric Holk
a785f3fc95 Adding a module with parallel vector operations.
This should go in libstd, but currently resolve bugs make this not
work.
2012-05-22 15:31:38 -07:00
Eric Holk
0b2f2cabbe Send is no longer a subkind of copy. This allows for sendable, but non-copyable resources. Closes #2420. 2012-05-22 14:10:32 -07:00
Niko Matsakis
83ee4ac5ea impl-ify map 2012-05-22 10:02:34 -07:00
Brian Anderson
b4da0364f9 Merge pull request #2413 from erickt/master
a couple misc changes
2012-05-21 17:32:12 -07:00
Brian Anderson
6d8cffa991 std: Make timer tests more reliable under valgrind 2012-05-21 17:29:00 -07:00
Niko Matsakis
34b42eeb65 change list so that it must be used in a purely boxed fashion
The old way was inconsistent---the head was unboxed but the
tail was boxed.  This resulted in numerous needless copies and
also made the borrow check unhappy, because the head tended to be
stored in mutable memory.
2012-05-21 09:37:34 -07:00
Niko Matsakis
1ad5f7d2c1 make list based on boxes 2012-05-21 06:18:12 -07:00
Erick Tryzelaar
24cfe29a8a std: Fix a typo 2012-05-19 10:08:44 -07:00
Erick Tryzelaar
e7ca3e4db0 expose tzset 2012-05-19 10:08:43 -07:00
Niko Matsakis
bfde2ba524 port smallintmap over to dvec
also: add a non-operator-overloaded method for [] to work around #2378
2012-05-18 20:00:51 -07:00
Niko Matsakis
35f6f37453 avoid modifying the variable we are alting over 2012-05-18 20:00:50 -07:00
Niko Matsakis
c9edc0f0a1 introduce a few copies here and there 2012-05-18 20:00:50 -07:00
Niko Matsakis
f9aef928ca purge ufind 2012-05-18 20:00:50 -07:00
Eric Holk
0eed37da29 Using const vector slices for more vec functions. 2012-05-18 16:55:42 -07:00
Brian Anderson
0f20cae37f std: Don't copy hash key until we must 2012-05-18 16:50:16 -07:00
Eric Holk
3c48759a56 Added a method to convert sets to vectors. 2012-05-17 12:00:50 -07:00
Lindsey Kuper
b8880e3254 Remove be keyword.
Closes #2227.
2012-05-15 10:41:14 -07:00
Tim Chevalier
2830bc3d31 Comment only: Annotate FIXMEs in std::time 2012-05-03 17:55:23 -07:00
Tim Chevalier
82d4fe3967 Write unicode::icu::UCHAR_INVALID_CODE as -1, removing a FIXME 2012-05-03 17:45:06 -07:00
Tim Chevalier
97c0b3848d Comments only: annotate more FIXMEs in libstd 2012-05-03 17:45:06 -07:00
Tim Chevalier
ca3a9f83f4 Annotate more FIXMES in libstd (comments only) 2012-05-03 15:36:47 -07:00
Tim Chevalier
f029e1f486 Annotate FIXMEs in std::bitv, and remove a FIXME
Changed a while loop into a for loop in std::bitv::equal. Yay!
2012-05-03 15:26:22 -07:00
Brian Anderson
8d9f67003a std: Do less work in the timer stress tests 2012-05-02 12:03:21 -07:00
Brian Anderson
36f7ace839 Merge pull request #2322 from bkircher/fix-getopts-docs
Fix getopts docs
2012-05-01 10:30:39 -07:00
Benjamin Kircher
1a19309d91 std: Fix example in getopts module docs
Issue #1833.
2012-05-01 04:55:19 +02:00
Benjamin Kircher
22254c3b48 std: Fix typo in getopts doc attribute 2012-05-01 04:12:17 +02:00
Brian Anderson
46cc11ea88 core: Serialize all access to the environment using a weak global task 2012-04-30 17:34:29 -07:00
Brian Anderson
c01d05f18d std: Add 2 timer stress tests 2012-04-28 14:13:36 -07:00
Jeff Olson
caab57586a rt/std: whitespace cleanup + work on hl/global_loop docs 2012-04-27 22:19:30 -07:00
Jeff Olson
92e88e4e2c std: another stab at a race-free global loop implementation
seems to hold up pretty well.

uv::hl API is affected.. had to do work on tests and std::timer code that
leverages the global loop/high_level_loop API.

see test_stress_gl_uv_global_loop_high_level_global_timer for a stress
example.. it takes a while to run, but it exits cleanly (something I could
never accomplish with earlier iterations of the global loop)
2012-04-27 22:19:30 -07:00
Jeff Olson
474e7e5e0d std: get rid of some un-needed rustrt native fns for the global loop 2012-04-27 22:19:30 -07:00
Jeff Olson
fbaba0f404 std: add ll::loop_refcount binding for uv_loop_refcount 2012-04-27 22:19:30 -07:00
Brian Anderson
7eec6eb2bb std: Add FIXME about time tests 2012-04-26 13:54:01 -07:00
Ted Horst
340dbcfdc8 temporary hack to make testing std::time reliable 2012-04-26 13:52:29 -07:00
Graydon Hoare
753b683939 More slice use in vec, io, str, ebml, metadata encoder and decoder. 2012-04-25 17:19:36 -07:00
Marijn Haverbeke
9f99c3263b Rewrite exhaustiveness checker
Issue #2111
2012-04-25 09:15:17 +02:00
Marijn Haverbeke
9053f54498 Move map iface over to more for-friendly iteration methods 2012-04-23 15:18:19 +02:00
Brian Anderson
bef5cd8e45 std: Export sort::le 2012-04-21 13:45:20 -07:00
Jeff Olson
f855682bed std: ignore tests that use high_level_loop
until race issue with (most likely) refcount scheme is sorted out
2012-04-20 16:46:50 -07:00
Jeff Olson
707391edbc std: add timer::recv_timeout() and whitespace cleanup 2012-04-20 15:23:23 -07:00
Jeff Olson
7ac8c3081c std: add std::timer and timer::delayed_send and timer::sleep
.. leveraging std::uv, we have:
timer::delayed_send - send a value over a provided channel after the
timeout has passed
timer::sleep - block the current task for the specified period

both of these fns (and everything that goes in timer.rs) leverage the
uv_timer_* API
2012-04-20 15:23:23 -07:00
Jeff Olson
a1c43cc7c9 std: dump old std::uv API.. move remaining tests into uv::ll 2012-04-20 15:23:23 -07:00
Jeff Olson
791ea3466d std::uv : cleanup and an isolated test for hand-rolled high_level_loops 2012-04-20 15:23:23 -07:00
Jeff Olson
e02057c5a5 std: fail if exiting hl_loop has unref_handles at weaken_task exit 2012-04-20 15:23:23 -07:00
Jeff Olson
a9db0c9efe whitespace cleanup 2012-04-20 15:23:23 -07:00
Jeff Olson
a045e63639 std: get_monitor_task_gl() is global_loop::get() default 2012-04-20 15:23:23 -07:00
Jeff Olson
e15f1d5cad std: refactor global_loop::get.. make it reusable 2012-04-20 15:23:23 -07:00
Jeff Olson
afb35f752f fix uv_timer_t size in 32bit linux and windows
.. fixes issue, in previous commit, with global loop test hanging on
32bit linux (this was because the struct was too small, so (presumably),
the data member was garbled.. yippy)
2012-04-20 15:23:23 -07:00
Jeff Olson
83ae83c3b3 uv::hl::get_global_loop() -> uv::global_loop::get()
- moved global loop tests, as well.. will add tests in uv_hl that encompass
rolling your own high_level_loop via uv::hl::run_high_level_loop()
- also whitespace cleanups and misc warning cleanup..
- doesn't work on 32bit linux
2012-04-20 15:23:22 -07:00
Jeff Olson
253fad7788 replace impl of globa_async_handle with one using atomic compare-and-swap 2012-04-20 15:23:22 -07:00
Jeff Olson
728f92604a fix a race in global loop test; unref_handle now takes a close_cb 2012-04-20 15:23:22 -07:00
Jeff Olson
9a5d1974dc don't use ::malloc for initializing the global_async_handle in rust_kernel 2012-04-20 15:23:22 -07:00
Jeff Olson
f21d25b54c make weak task that runs libuv loop unsupervised 2012-04-20 15:23:22 -07:00
Jeff Olson
e0f110aa12 clean and trying the global loop test as two separate loop lifetimes..
.. seeing an occasional valgrind/barf spew on some invalid read/writes..
need to investigate further.. i think its related to my poor citizen
conduct, re: pointers stashed in rust_kernel..
2012-04-20 15:23:22 -07:00
Jeff Olson
31ba223c26 end-to-end impl of global loop w/ high-level ref counting.. needs work
- starting/stoping the loop based on client work is functioning, correctly
- the issue appears to be that, when the process is about to exit, the
signal to let weak tasks know that they need to exit isn't getting fired.
2012-04-20 15:23:22 -07:00
Jeff Olson
e6f6a8ced4 tweaking rust getter/setters for libuv data to use generics 2012-04-20 15:23:22 -07:00
Jeff Olson
12f2f4c15c rt: whitespace cleanup for existing libuv integration 2012-04-20 15:23:22 -07:00
Jeff Olson
e604c15df1 bindings to get/set data field on uv_loop_t* and debug log cleanup 2012-04-20 15:23:21 -07:00
Jeff Olson
bf99a3aa93 adding low-level uv_timer_* stuff to libuv bindings 2012-04-20 15:23:21 -07:00
Jeff Olson
3d004c6df8 making brson's req. cleanups in #2134 plus change printf to LOG in c++ 2012-04-20 15:23:21 -07:00
Graydon Hoare
956bc773c6 Fix [] on str to exclude the trailing null. 2012-04-18 17:50:58 -07:00
Marijn Haverbeke
a65af017ca Remove tri.rs and four.rs
Closes #1892
2012-04-18 17:21:39 +02:00
Haitao Li
39c5e06526 Revert "libstd: Handle test results in serial"
This reverts commit 828d0677c4.
2012-04-13 18:34:45 +08:00
Haitao Li
2955ecd13c Revert "libstd: Colorify test results when run in parallel"
This reverts commit 7b3cb05311.
2012-04-13 18:34:41 +08:00
Haitao Li
7b3cb05311 libstd: Colorify test results when run in parallel
Closes #782
2012-04-12 17:33:07 +08:00
Haitao Li
828d0677c4 libstd: Handle test results in serial
Issue #782
2012-04-12 17:33:01 +08:00
Jeff Olson
52e084b92a ignore tcp server/client test on linux 32bit, pending #2064
also println->log(debug,) and assorted cleanup ahead of merge to master
2012-04-06 15:35:50 -07:00
Jeff Olson
82f8d8cb2a removing some unneeded native fn mappingsin uv.rs and misc clean
.. 32bit linux issues persist.
2012-04-06 15:35:50 -07:00
Jeff Olson
6b349f3d11 experimenting with a different uv_buf_init impl to placate 32bit linux 2012-04-06 15:35:50 -07:00
Jeff Olson
6189a0814b whitespace cleanup in uv_* 2012-04-06 15:35:50 -07:00
Jeff Olson
ed3c8610c3 adding 32bit-unix struct struct size differences 2012-04-06 15:35:50 -07:00
Jeff Olson
79269ea064 fixing some libuv stuff that leaked through the rebase 2012-04-06 15:35:50 -07:00
Jeff Olson
b39a43cd5c adding uv_hl module and some doc work 2012-04-06 15:35:50 -07:00
Jeff Olson
7c0fed469f rename uv::direct:: to uv::ll:: and put into its own crate 2012-04-06 15:35:50 -07:00
Jeff Olson
f18991d900 getting rid of ip4 port byval test... 2064 workarounds in place, for now 2012-04-06 15:35:50 -07:00
Jeff Olson
b712e5e132 line length fixes for make check 2012-04-06 15:35:49 -07:00
Jeff Olson
55143bb14c docs tweak for uv module 2012-04-06 15:35:49 -07:00
Jeff Olson
26addfdd81 fix size of uv_async_t on windows. is this the cause of the libuv segfault? 2012-04-06 15:35:49 -07:00
Jeff Olson
2b606ae5f3 add libuv error msg helpers.. flushing out windows tcp issue. 2012-04-06 15:35:49 -07:00
Jeff Olson
2c26cf7f96 add low-level uv_async bindings for use in tcp test 2012-04-06 15:35:49 -07:00
Jeff Olson
7176321685 refactored the tcp request and server tests into 1 test using loopback
..plus whitespace cleanup for make check
2012-04-06 15:35:49 -07:00
Jeff Olson
922ed6f947 hello world test for a tcp server in libuv
.. im now going to refactor the tcp request and server tests to utilize
each other, so no more external network ugliness
2012-04-06 15:35:49 -07:00
Jeff Olson
85e26eff6a fixing libuv stuff in win32 (see #2064) .. pass sockaddr_in by-ref, for now 2012-04-06 15:35:49 -07:00
Jeff Olson
ab1efb900e fixed unix uv struct err from prev commit, also starting uv docs 2012-04-06 15:35:49 -07:00
Jeff Olson
fcc973b5ac massaging out struct-size differences between unix and win32 2012-04-06 15:35:49 -07:00
Jeff Olson
1eff88f434 win32 tweaks 2012-04-06 15:35:48 -07:00
Jeff Olson
9ad67e8c14 test_uv_tcp_request() fully working on linux
.. up next: windows!
.. impl'd uv::direct::read_stop() and uv::direct::close() to wrap things up
.. demonstrated sending data out of the uv_read_cb via a channel (which
we block on to recv all of it, complete w/ EOF notification) that is
read from after the loop exits.
.. helpers to read the guts of a uv_buf_t
.. an idea im kicking around: starting to pile up all of these hideous
data accessor functions in uv::direct .. I might make impl/iface pairs
for the various uv_* types that I'm using, in order to encapsulate those
data access functions and, perhaps, make the access look a little cleaner
(it still won't be straight field access, but it'll be a lot better)
.. formatting cleanup to satisfy make check
2012-04-06 15:35:48 -07:00
Jeff Olson
877747d0ac wired up uv_read_start and some helper funcs around uv_alloc_cb tasks 2012-04-06 15:35:48 -07:00
Jeff Olson
e0193dac6e uv_buf_t's for uv_write() passed by-val .. no more mallocs or ptr cop-outs
so we're now adhering the libuv C api and passing structs by-val where
it is expected, instead of pulling pointer trickery (or worse having to
malloc structs in c++ to be passed back to rust and then into C again)
2012-04-06 15:35:48 -07:00
Jeff Olson
e5ccc76bc4 fixed by-val from rust->c, use ++ sigil in native fn sig <-- NEVAR FORGET
have to use ++ sigil in rust-side extern fn decls in order to have rust
actually copy the struct, by value, onto the C stack. gotcha, indeed.

also adding a helper method to verify/remind how to pass a struct by-val
into C... check out the rust fn sig for rust_uv_ip4_test_verify_port_val()
for more infos
2012-04-06 15:35:48 -07:00
Jeff Olson
43c82bdb45 fixed passing in uv_buf_t ptr array in uv_write.. return status 0
ways to go, still..
2012-04-06 15:35:48 -07:00
Jeff Olson
f179029296 uv_write works, buffer passing still broke, can get sockaddr_in by val
.. but passing sockaddr_in by val back to C is broken, still passing by
ptr
.. the uv_write_cb is processed, but we have a status -1.. there is
also valgrind spew.. so buf passing is broken, still.
2012-04-06 15:35:48 -07:00
Jeff Olson
05e2c131c4 changing ctypes:: to libc:: and impl of uv::direct::write() 2012-04-06 15:35:48 -07:00
Jeff Olson
af08aba573 some more stuff for libuv dealing w/ 1402.. should go away soon 2012-04-06 15:35:48 -07:00
Jeff Olson
3817ba7578 adding uv::direct and beginning to work out tcp request case
lots of changes, here.. should've commited sooner.
- added uv::direct module that contains rust fns that map, neatly, to
the libuv c library as much as possible. they operate on ptrs to libuv
structs mapped in rust, as much as possible (there are some notable
exceptions). these uv::direct fns should only take inputs from rust and,
as neccesary, translate them into C-friendly types and then pass to the
C functions. We want to them to return ints, as the libuv functions do,
so we can start tracking status.
- the notable exceptions for structs above is due to ref gh-1402, which
prevents us from passing structs, by value, across the Rust<->C barrier
(they turn to garbage, pretty much). So in the cases where we get back
by-val structs from C (uv_buf_init(), uv_ip4_addr(), uv_err_t in callbacks)
, we're going to use *ctypes::void (or just errnum ints for uv_err_t) until
gh-1402 is resolved.
- using crust functions, in these uv::direct fns, for callbacks from libuv,
will eschew uv_err_t, if possible, in favor a struct int.. if at all
possible (probably isn't.. hm.. i know libuv wants to eventually move to
replace uv_err_t with an int, as well.. so hm).
- started flushing out a big, gnarly test case to exercise the tcp request
side of the uv::direct functions. I'm at the point where, after the
connection is established, we write to the stream... when the writing is
done, we will read from it, then tear the whole thing down.

overall, it turns out that doing "close to the metal" interaction with
c libraries is painful (and more chatty) when orchestrated from rust. My
understanding is that not much, at all, is written in this fashion in the
existant core/std codebase.. malloc'ing in C has been preferred, from what
I've gathered. So we're treading new ground, here!
2012-04-06 15:35:48 -07:00
Marijn Haverbeke
c902eafa14 Convert old-style for loops to new-style
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.

(This hack will go away soon.)

Issue #1619
2012-04-06 20:38:23 +02:00
Brian Anderson
d13c0c77a2 Explicitly use version 0.2 of crates 2012-04-05 20:29:42 -07:00
Tim Chevalier
98b07ddc82 Rename task::task_builder to task::builder
Closes #2120.
2012-04-05 14:09:32 -07:00
Erick Tryzelaar
552677e598 std: time.rs should pass all args by "&&" to rustrt. 2012-04-05 12:23:37 -07:00
Grahame Bowland
5cc050b265 Logfile output from tests; summarise in make check
Add an optional --logfile argument to std::test::test_main and to
compiletest.

Use this features and the new 'check-summary.py' script to
summarise all the tests performed by the 'check' target. This is
a short term fix for #2075.
2012-04-04 11:52:27 -07:00
Erick Tryzelaar
159d89604e std: add a pure rust strptime parser. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
ff9305cd99 std: add a pure rust strftime formatter. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
4a4889859e std: add localtime/gmtime support. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
4871f11439 std: change timeval to ns resolution timespec
This lets us use the more precise clock_gettime on posix
machines.
2012-04-03 22:43:08 -07:00
Erick Tryzelaar
7aae7320db std: change time::timeval to be {sec: i64, usec: i32}.
It's possible to have negative times if expressing time before 1970, so
we should use signed types. Other platforms can return times at a higher
resolution, so we should use 64 bits.
2012-04-03 22:43:08 -07:00
Patrick Walton
c2f28e231f stdlib: Remove the now-obsolete vec::alloc_len in favor of vec::capacity 2012-03-29 08:57:34 -07:00
Patrick Walton
166d14e42d stdlib: Actually increase arena chunk sizes by powers of two 2012-03-29 08:41:26 -07:00
Patrick Walton
b210c7ad97 stdlib: Allow the fast path of arena allocation to be CCI'd. 15% improvement on binary-trees. 2012-03-29 08:41:26 -07:00
Patrick Walton
1d25594657 rustc: Add a vec::alloc_len and fix arena logic to use it 2012-03-29 08:41:26 -07:00
Patrick Walton
5ce3d35f41 rustc: Don't zero out arena chunks with vec::from_elem; that's slow because it calls the glue. 2012-03-29 08:41:25 -07:00
Patrick Walton
6f0cbf4cd4 stdlib: Fix a pointer mistake in arenas 2012-03-29 08:41:25 -07:00
Graydon Hoare
b37d7e26fe Update crate URLs to point to interesting things. 2012-03-28 13:52:47 -07:00
Marijn Haverbeke
b5a4fa9456 Move some code over to iterator-for to see how it performs. 2012-03-27 15:46:33 +02:00
Marijn Haverbeke
eec6383771 Add vec::each, vec::eachi, and list::each
For use with the new for construct.

Issue #1619
2012-03-27 12:53:19 +02:00
Graydon Hoare
6e6798c4e1 Bulk-edit mutable -> mut. 2012-03-26 18:35:18 -07:00
Marijn Haverbeke
87e097a853 Disallow ret inside of block functions
Also adds proper checking for cont/break being inside a loop.

Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Niko Matsakis
042c532a08 Implement new inference algorithm. 2012-03-23 21:47:28 -07:00
Marijn Haverbeke
3e7a514521 Fix inconsistent-iteration hazard in map.rs
Closes #2049
2012-03-23 13:30:29 +01:00
Brian Anderson
f3fe85dad7 Bump version numbers to 0.2 2012-03-22 15:25:02 -07:00
Niko Matsakis
dc07280b08 make --enforce-mut-vars always on, add mut annotations to remaining files 2012-03-22 09:58:19 -07:00
Niko Matsakis
cce2751461 Adjust arena definition to be compatible with placement new 2012-03-21 05:46:31 -07:00
Patrick Walton
ba39e277e2 stdlib: Implement arenas 2012-03-20 19:08:17 -07:00
Brian Anderson
b181ea415e core: Rename unsafe::leak to unsafe::forget. Closes #2031 2012-03-20 15:20:37 -07:00
Marijn Haverbeke
cec1a9b859 Properly check kinds when instantiating types
Closes #2011
2012-03-19 10:45:29 +01:00
Brian Anderson
47d468f08c core: Store reexporting result and either. Closes #1997 2012-03-16 15:14:37 -07:00
Erick Tryzelaar
67a1c35264 std: Add a a hashmap_from_vecs function 2012-03-16 17:05:29 +01:00
Marijn Haverbeke
35fc4a4291 Check kind bounds when calling methods
Closes #1915
2012-03-16 17:05:29 +01:00
Brian Anderson
7e0fa3f852 std: Swap the argument order of list::foldl to match vec::foldl 2012-03-15 14:15:49 -07:00
Brian Anderson
5e8004d493 std: Follow conventions in bitv 2012-03-15 14:08:47 -07:00
Brian Anderson
3864d6d845 std: Rename the hashmap constructors to conform to new standards
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Niko Matsakis
a3d2882ffd fixup auto_serialize's treatment of nullary variants 2012-03-14 21:05:06 -04:00
Niko Matsakis
e702d20191 allow immut vars to be moved. enforce mut vars after stage0 in std. 2012-03-14 20:46:36 -04:00
Niko Matsakis
6b35875dca annotate libstd and start enforcing mutability 2012-03-14 20:46:36 -04:00
Niko Matsakis
1600be2c3b fix auto_serialize for enums with type parameters 2012-03-14 17:19:33 -04:00
Niko Matsakis
ffa187db25 adjust auto_serialize to generate fns named serialize_T()
We used to generate a module T with a serialize() and deserialize() fn,
but this was suboptimal for a number of reasons:

- it required moving serialization into core so that uint etc worked
- it was harder to override the serialization behavior locally
  (this is now trivial)
2012-03-14 11:49:28 -04:00
Niko Matsakis
b30cb8e43a implement deserialization, rename mk_mem_buffer() to mem_buffer() 2012-03-13 21:30:07 -04:00
Niko Matsakis
d91742294f first (functional) version of the auto_serialize syntax ext 2012-03-13 21:30:07 -04:00
Brian Anderson
b968c8e6cd Name types after their modules instead of 't' 2012-03-13 15:14:17 -07:00
Brian Anderson
cd72b1f848 Overhaul constructor naming in libs 2012-03-13 11:07:22 -07:00
Graydon Hoare
6f5853f5a1 Libc/os/run/rand/io reorganization. Close #1373. Close #1638.
- Move io, run and rand to core.
 - Remove incorrect ctypes module (use libc).
 - Remove os-specific modules for os and fs.
 - Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Patrick Walton
4571175568 stdlib: Make list::find do what the docs say it does.
Talked on #rust about this change, got approval from graydon and brson. Will bring up tomorrow at meeting to verify.
2012-03-12 18:28:16 -07:00
Brian Anderson
d60813146d std: Sort test failures. Closes #1929 2012-03-12 17:31:17 -07:00
Tim Chevalier
40a5c56345 Fix Windows build breakage 2012-03-10 20:44:10 -08:00
Tim Chevalier
35400e13ad Use loop instead of while(true) in libraries and compiler itself
And remove spurious fails/unreachable() calls.
2012-03-10 20:34:17 -08:00
Brian Anderson
91e5a1c8b3 core: Remove the nearly empty math module
This mod only had two functions, all of whose users have been changed
to use the uint module.
2012-03-10 17:43:19 -08:00
Brian Anderson
95521c4084 std: Convert to rustdoc 2012-03-09 22:56:53 -08:00
Tim Chevalier
321fd80219 Add an infinite loop construct
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Tim Chevalier
0c5fdc8745 Rename last to last_opt, last_unsafe to last
As per discussion on IRC. I am about to file an RFC for further
discussion about the more general issue of whether to enforce
invariants through types, typestate, or dynamic checks, but for now,
removing the misleading name "last_unsafe".
2012-03-08 15:25:56 -08:00
Tim Chevalier
d048a00cf3 Change util::unreachable to core::unreachable
Closes #1931
2012-03-08 14:30:01 -08:00
Tim Chevalier
ebc1d3e704 Rename last_total to last_unsafe
See Issue 1943 for any discussion (reopen it if necessary).

Closes #1943
2012-03-08 13:07:31 -08:00
Patrick Walton
c9375fed8d stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980 Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
This reverts commit f0250a23d3.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3 stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Brian Anderson
d2135597e9 std: Use util::unreachable 2012-03-05 18:23:01 -08:00
Graydon Hoare
6c87c34277 Remove dead code from rt (debug_obj, rust_obj, rust_closure, rust_box_obj, rust_vtable) 2012-03-05 15:50:11 -08:00
Erick Tryzelaar
faccd4ac92 std: export json::error. 2012-03-05 08:47:21 -08:00
Erick Tryzelaar
6b0c4822c1 std: add a fs::remove_file function. 2012-03-02 19:15:36 -08:00
Erick Tryzelaar
f630ebdb6a comp/std: rename io::string_reader to io::str_reader. 2012-03-02 19:15:35 -08:00
Erick Tryzelaar
1404a864a4 std: add a io::with_str_reader fn to remove a str copy 2012-03-02 19:15:34 -08:00
Brian Anderson
3ed6f6520f core: Remove _mut functions from vec
Instead, use vec::to_mut/from_mut to transform vectors in place as
needed.
2012-03-02 15:49:49 -08:00
Brian Anderson
77fc4e7ee7 std: vec::to_ptr -> vec::unsafe::to_ptr 2012-03-02 12:29:40 -08:00
Brian Anderson
1471b1f3ff std: DeCamelCase fs::splitDirnameBasename 2012-02-29 23:45:51 -08:00
Tycho Sci
ecf87c3180 libstd: Skip trailing whitespaces after JSON value 2012-02-29 17:47:17 +09:00
Tycho Sci
0465d5217d libstd: Skip trailing whitespaces after outer rparen
This makes "{ \"foo\": 1 }\n" and "[ 1 ]\n" valid json string
2012-02-29 16:24:28 +09:00
Erick Tryzelaar
012dec5e57 std: rewrite json.rs to fix bugs and use readers/writers
Our json implementation did not conform to the spec, and
was missing support for escpaed characters and exponental
numbers. This fixes it, and adds support for reading/writing
json directly from/to a stream.

There are two things left unimplemented. We could use a
"to_json" iface/impl, but that really needs traits to cut
down on code duplication. The other is it wouldn't be that
not that hard to turn this implementation into a event driven
parser like YAJL, but I ran into some type-inference bugs,
so I cut that out. It'd be nice to revisit this in the future
though.
2012-02-28 18:00:50 -08:00
Erick Tryzelaar
6865df2611 core/std: whitespace fixes. 2012-02-28 18:00:50 -08:00
Erick Tryzelaar
ec51d8fd03 std: Add helpers to simplify making str io::writers 2012-02-28 18:00:50 -08:00
Brian Anderson
b9089b5335 std: Ignore uv tests on FreeBSD 2012-02-28 17:56:15 -08:00
Jeff Olson
9831ee3e67 changing rust loop to 1 thread 2012-02-28 17:56:15 -08:00
Jeff Olson
b4c88cdcec add uv::loop_delete()
because of the last change, the loop ptr is no longer cleaned up
when the loop exits. This api call addresses that. Sadly, the loop
ptr is not "reusable" across multiple calls to uv::run().
2012-02-28 17:56:15 -08:00
Jeff Olson
0b3a06ab2c correcting for libuv behavior that differs between linux & windows
net complexity increase :/
2012-02-28 17:56:15 -08:00
Jeff Olson
bb5960aa57 moving new uv stuff into uv.rs and rust_uv.cpp
- removing the remains of uvtmp.rs and rust_uvtmp.rs
- removing the displaced, low-level libuv bindings
in uv.rs and rust_uv.cpp
2012-02-28 17:56:15 -08:00
Jeff Olson
828595151c trailing whitespace fixes 2012-02-28 17:56:15 -08:00
Jeff Olson
1d3e08d8c6 finishing up simple uv_timer impl
as it stands, basic async nad timer support is added
2012-02-28 17:56:15 -08:00
Jeff Olson
b68eb507da cleaning up uv_async stuff and stubbing uv_timer 2012-02-28 17:56:14 -08:00