Commit Graph

517 Commits

Author SHA1 Message Date
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
Jeff Olson
974c23cbeb removed hello world and added uv_async_* 2012-02-28 17:56:14 -08:00
Jeff Olson
ffad8d7f0c everything is laid out and working through a basic hw
the core impl is there, with a async handle in place
to take incoming operations from user code. No actual
uv handle/operations are implemented yet, though.
2012-02-28 17:56:14 -08:00
Niko Matsakis
5c1338a18e add ability to run multi-crate tests, run tests with --inline 2012-02-28 06:31:29 -08:00
Niko Matsakis
8cffc6f84c add debugging mode which emits more verbose info 2012-02-28 06:31:28 -08:00
Brian Anderson
61691c2428 std: Make merge_sort faster 2012-02-27 18:32:45 -08:00
Niko Matsakis
f3ca50c9ca Encode/decode AST into metadata, re-instantiate inlined items 2012-02-24 20:46:27 -08:00
Marijn Haverbeke
780f8277f4 Finish cleanup of core::str
Closes #1849
2012-02-23 17:00:19 +01:00
Marijn Haverbeke
d802c1fbd2 Various cleanups and optimizations in core::str 2012-02-23 17:00:19 +01:00
Kevin Cantu
c3318f29fe (core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
7782f5d692 (core::str) remove len_bytes alias 2012-02-23 17:00:19 +01:00
Kevin Cantu
1b957c0942 (core::str) replace uses of unsafe::slice_bytes; replace find[_from]_bytes with find[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
6ea3d7935e (core::str) replace byte_index[_from] with index[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
280633a728 (core::str) do some replacements 2012-02-23 17:00:19 +01:00
Kevin Cantu
454b53a7c2 (core::char) rename slice -> slice_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
1cd5a0945a (core::str) rename rindex -> rindex_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
98447f5236 (core::str) mostly rename len -> len_chars 2012-02-23 17:00:19 +01:00
Marijn Haverbeke
ffd50b9cdf Make the various from_str functions return options
So that they can be used with user input without causing task
failures.

Closes #1335
2012-02-22 13:18:15 +01:00
Marijn Haverbeke
ad03761a97 Remove preconditions from libraries
Closes #1805
2012-02-22 11:47:47 +01:00
Brian Anderson
4220dcf1e9 core: New task API 2012-02-20 18:58:04 -08:00
Brian Anderson
010f2abc70 core: When running tests sequentially, print the test name before running it
Useful for debugging hanging tests
2012-02-18 16:30:09 -08:00
Chris Peterson
3d202d7eae rt: rename nano_time() builtin to match time::precise_time_ns() 2012-02-18 01:39:42 -08:00
Chris Peterson
b73bc30858 std: Add tests for time module
Tested on OSX and Windows.
2012-02-18 01:32:52 -08:00
Chris Peterson
105b5f0be8 std: Expand doc comments for time module 2012-02-18 01:30:12 -08:00
Chris Peterson
94fe5011e2 std: Add some env() and getenv() tests 2012-02-17 08:47:45 +01:00
Chris Peterson
aec76d2515 std: Fix env() assert when an environment variable's value contains a '=' char 2012-02-17 08:47:44 +01:00
Marijn Haverbeke
67cc89f38d Rewrite exhaustiveness checker
Issue #352
Closes #1720

The old checker would happily accept things like 'alt x { @some(a) { a } }'.
It now properly descends into patterns, checks exhaustiveness of booleans,
and complains when number/string patterns aren't exhaustive.
2012-02-15 15:47:42 +01:00
Marijn Haverbeke
4b63826050 Replace some explicit fails with 'alt check' invocations 2012-02-15 15:47:42 +01:00
Brian Anderson
acabd821d2 Merge pull request #1831 from killerswan/str_fixes
(core::str) changes to find / find_bytes
2012-02-14 11:22:31 -08:00
Niko Matsakis
3a2f1e1876 add serialization library; convert ebml lib to use u64 internally 2012-02-13 06:50:58 -08:00
Kevin Cantu
c81867474a (core::str) add find_bytes and export it... 2012-02-13 01:56:58 -08:00
Kevin Cantu
2ba44e24d5 (core::str) rename byte_len_range -> substr_len_bytes and
rename char_len_range -> substr_len_chars
2012-02-12 15:30:20 -08:00
Kevin Cantu
2b4f5136a5 (core::str) rename byte_len -> len_bytes and rename char_len -> len 2012-02-12 15:30:20 -08:00
Kevin Cantu
944f5a6598 (core::str) move push_byte, push_bytes, pop_byte, and shift_byte into str::unsafe 2012-02-12 15:30:20 -08:00
Kevin Cantu
e0af23b664 using str::rindex... 2012-02-11 16:39:39 -08:00
Kevin Cantu
27161f4415 using str::index... 2012-02-11 16:39:39 -08:00
Kevin Cantu
a131b430a0 core::str rename [r]index -> [r]index_bytes 2012-02-11 16:39:39 -08:00
Niko Matsakis
e712a47a81 create serialization lib and update serializer to use it 2012-02-10 20:48:29 -08:00
Niko Matsakis
fdddf8f9e1 put serializer into the build and encode full item paths 2012-02-10 20:48:28 -08:00
Niko Matsakis
5d57fa3403 update ebml interface 2012-02-10 20:48:28 -08:00
Marijn Haverbeke
52a741754c Remove some pointless imports 2012-02-09 15:30:27 +01:00
Marijn Haverbeke
50fb4c30ed Increase precedence of as operator
Closes #1717
2012-02-09 11:58:08 +01:00
Brian Anderson
6cf40bd0c4 std: Use correct split function in generic_os::env 2012-02-07 20:20:58 -08:00
Graydon Hoare
93450abb4b Make process-spawning take environments and working directories, remove procsrv task from compiletest. 2012-02-07 19:57:03 -08:00
Kevin Cantu
2b0396c34a core: make str::substr use char positions (and replace other uses) 2012-02-07 16:25:35 -08:00
Kevin Cantu
a3f5626ad1 String split renaming:
* Renamed str::split -> str::split_byte
* Renamed str::splitn -> str::splitn_byte
* Renamed str::split_func -> str::split
* Renamed str::split_char -> str::split_char
* Renamed str::split_chars_iter -> str::split_char_iter
* Added u8::is_ascii
* Fixed the behavior of str::split_str, so that it matches split_chars
  and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", "."))
* Fixed str::split_byte and str::splitn_byte so that they handle
  splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle ""
  as the others do
2012-02-07 16:25:35 -08:00
Brian Anderson
fdf50e84b8 std: Use ctypes::c_int in path_is_dir 2012-02-05 16:21:52 -08:00
Brian Anderson
91b6dc5c8e Merge remote-tracking branch 'erickt/master'
Conflicts:
	src/libcore/vec.rs
	src/libstd/getopts.rs
2012-02-05 15:15:21 -08:00
Tom Lee
31b0d1b4bd core: rename str::lteq to str::le 2012-02-03 14:09:44 +01:00
Tom Lee
a02f332602 std: rename sort::lteq to sort::le. 2012-02-03 12:02:57 +01:00
Graydon Hoare
c485301d21 Update libuv. 2012-02-02 17:39:47 -08:00
Graydon Hoare
6784b18303 Win32 warning police. 2012-02-02 11:35:07 -08:00
Kevin Cantu
ae0d49aa06 Rename str::char_slice -> str::slice 2012-02-01 21:56:53 -08:00
Kevin Cantu
8f367ebfeb Rename (again) str::unsafe::slice -> str::unsafe::slice_bytes and
str::unsafe::safe_slice -> str::unsafe::slice_bytes_safe_range
2012-02-01 21:56:53 -08:00
Kevin Cantu
6156bc56cb Propagating unsafe::slice 2 2012-02-01 21:56:53 -08:00
Kevin Cantu
47c57a17dc Propagating unsafe::slice 1 2012-02-01 21:56:53 -08:00
Marijn Haverbeke
856a544d0c Remove native types from stdlib 2012-02-01 12:23:13 +01:00
Tim Chevalier
e5d095d67e Change option::t to option
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.

The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00
Kevin Cantu
685a434e0a Rename str::loop_chars to str::all,
rename str::loop_chars_sub to str::substr_all, and
propagate this change to std::rope and rustdoc's calls to these
2012-01-31 14:29:11 -08:00
Tim Chevalier
fba35e1a3c Require alts to be exhaustive
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
2012-01-31 10:08:24 -08:00
Paul Woolcock
e1251f7b00 Change all ternary ops to if/then/else
All the files below had at least one instance of the ternary operator
present in the source.  All have been changed to the equivalent
if/then/else expression.
2012-01-30 18:21:01 +01:00
Erick Tryzelaar
5b2c0a999f std: Whitespace cleanup. 2012-01-28 09:18:35 -08:00
Erick Tryzelaar
259636a112 core: rename vec::position* functions
Almost all of the vec functions that predicates don't have a
corresponding function that takes a single element, so this
commit renames the common fn usecase to be the default.
2012-01-28 09:18:34 -08:00
Brian Anderson
3321880f13 Merge remote-tracking branch 'killerswan/fixing_strings_2'
Conflicts:
	src/comp/driver/driver.rs
	src/comp/middle/trans/base.rs
	src/comp/syntax/parse/lexer.rs
2012-01-27 16:44:40 -08:00
Brian Anderson
7e620f87a6 std: Long lines 2012-01-27 15:11:45 -08:00
Donovan Preston
6b42e6b298 Re-apply fixes brson made. 2012-01-27 15:07:29 -08:00
Donovan Preston
3d76922f97 Implement timers. 2012-01-27 14:04:13 -08:00
Marijn Haverbeke
e48bf6f3f4 Make occurs check in ty::fixup_vars more reliable
It wouldn't detect cycles that went through several type vars before.

Closes #1464
2012-01-27 18:58:52 +01:00
Brian Anderson
335302f08d std: Fix types in uvtmp tests 2012-01-26 16:19:46 -08:00
Donovan Preston
9e39219d9b Shuffle around to work with rust-spidermonkey 2012-01-26 16:01:26 -08:00
Kevin Cantu
5847cf0367 (TEMPORARY) Break something by making io::mem_buffer_str UTF-8 safe 2012-01-25 21:53:37 -08:00
Kevin Cantu
a185b10647 Replacing str::unsafe_from_bytes with str::from_bytes (part 6) 2012-01-25 01:42:28 -08:00
Kevin Cantu
57717fa4d8 Replacing str::unsafe_from_bytes with str::from_bytes (part 5) 2012-01-25 01:29:44 -08:00
Kevin Cantu
c7b23f9a86 Replacing str::unsafe_from_bytes with str::from_bytes (part 1) 2012-01-25 00:53:17 -08:00
Niko Matsakis
5e13d19cc0 s/block()/fn()/g 2012-01-23 19:06:33 -08:00
Brian Anderson
07f8555b3e std: Add some hacks to use libuv 2012-01-22 20:06:58 -08:00
Niko Matsakis
42b97f317a use u64 and not uint; otherwise shift results are undef. in 32 bit
Fixes #1605.
2012-01-21 19:31:52 -08:00
Niko Matsakis
de2bb2806f update to use u64; u32 has undefined results 2012-01-21 19:31:52 -08:00
Brian Anderson
52b1623089 std: Remove extfmt. Has been moved to core. Closes #1600 2012-01-21 13:51:54 -08:00
Graham Fawcett
fc2ae08b9c issue #1352: change param order on {std,core}::extfmt::str_init_elt to mirror vec::init_elt. 2012-01-21 13:33:16 -08:00
Graham Fawcett
7763b40c71 issue #1352: change param order on vec::init_elt, putting block in final position.
To match the init_fn() and init_fn_mut() changes.
2012-01-21 13:33:16 -08:00
Graham Fawcett
35d12be2ce fix #1352: change param order on vec::init_fn (and vec::init_fn_mut), putting block in final position. 2012-01-21 13:31:12 -08:00
Graydon Hoare
7b1a8f0a91 Additional ; to , changes, disable "tag" and ";" in parser. Close #1430. Close #1428. 2012-01-19 19:29:21 -08:00
Patrick Walton
6222e98dda lib: ';' to ',' in enums in more places 2012-01-19 19:08:49 -08:00
Patrick Walton
194d8e3bd5 lib: ";" to "," in enums 2012-01-19 18:04:24 -08:00
Brian Anderson
6d4884d983 libcore: Use 4x the number of scheduler threads for testing
An arbitrary number. I've done no measurements but it's intended to overcome
the effects of tasks randomly being scheduled to threads and no work stealing.

If scheduler threads == 1 then we just use a single test task.
2012-01-19 17:54:21 -08:00
Brian Anderson
928e55815c libcore: Do less blocking in the test runner 2012-01-19 17:54:21 -08:00
Patrick Walton
c5a407b11b stdlib: "tag" -> "enum" 2012-01-19 15:22:25 -08:00
Brian Anderson
48e916c8fa libstd: Long lines 2012-01-19 13:44:07 -08:00
Brian Anderson
f15182fffc Use fn~ to simplify the core::test interface 2012-01-19 13:37:01 -08:00
Tim Chevalier
5b028f527f Remove support for the '.' after a nullary tag in a pattern
(Commit also includes lots of changes to remove '.'s that a git
merge messed up, or else it was monkeys.)
2012-01-19 01:04:59 -08:00
Tim Chevalier
04a2887f87 Remove '.' after nullary tags in patterns
Does what it says on the tin.

The next commit will remove support for this syntax.
2012-01-18 23:17:34 -08:00
Haitao Li
7b1724fb40 libstd: Revert an integer type casting
Otherwise, rustctest failed by a segv fault.
2012-01-19 02:24:22 +08:00
Haitao Li
04882d7c43 rustc: Use integer from ctypes consistently 2012-01-19 02:10:36 +08:00
Haitao Li
dde41869ce Use ctypes in native function declarations 2012-01-19 02:10:36 +08:00
Brian Anderson
6e27b27cf8 libstd: Move std tests into libstd 2012-01-17 19:48:58 -08:00
Lenny222
b19fdcced2 libstd => libcore 2012-01-17 10:51:43 -08:00
Lenny222
106dcf7b92 spin-off rustdocs tuple code to libstd 2012-01-17 10:51:43 -08:00
Tim Chevalier
c3bc8fada8 Allow omission of the '.' after nullary tag patterns
This commit allows patterns like:

alt x { some(_) { ... } none { } }

without the '.' after none. The parser suspends judgment about
whether a bare ident is a tag or a new bound variable; instead,
the resolver disambiguates.

This means that any code after resolution that pattern-matches on
patterns needs to call pat_util::normalize_pat, which consults
an environment to do this disambiguation.

In addition, local variables are no longer allowed to shadow
tag names, so this required changing some code (e.g. renaming
variables named "mut", and renaming ast::sub to subtract).

The parser currently accepts patterns with and without the '.'.
Once the compiler and libraries are changed, it will no longer
accept the '.'.
2012-01-17 10:08:16 -08:00
Marijn Haverbeke
e046360e69 Add an std::md4 module 2012-01-17 12:02:04 +01:00
Brian Anderson
26551e5481 libstd: Remove util::void 2012-01-14 02:51:08 -08:00
Brian Anderson
a3f5c66484 libstd: Remove util::orb. Redundant with core::bool 2012-01-14 02:48:16 -08:00
Marijn Haverbeke
7150643588 Remove workaround for issue #1494
We have a snapshot that includes the fix.
2012-01-13 21:38:29 +01:00
Niko Matsakis
8685a1f7c4 distinguish "any closure" and "stack closure" (block) 2012-01-13 09:31:40 -08:00
Niko Matsakis
3f3bfeec27 make "native fn" the type for bare functions, remove fn exprs 2012-01-13 06:27:35 -08:00
Niko Matsakis
455f8b0d45 deprecate fn exprs and the fn() type, preferring fn@ and native fn 2012-01-13 06:27:34 -08:00
Brian Anderson
2c70b2fb7e libstd: Remove a bogus link_name attribute 2012-01-11 20:01:55 -08:00
Brian Anderson
6e1f9ad1f1 rustc: Don't allow empty link_name when nolink attribute is present
Closes #1326
2012-01-11 19:45:18 -08:00
Marijn Haverbeke
4c9c1cd199 Fix dependency bug iface-did-of-impl resolving
By simply not resolving that def id until the typeck pass.

Closes #1494
2012-01-11 21:40:13 +01:00
Marijn Haverbeke
34d7f05292 Major clean-up of std::io
Use ifaces instead of objs, stop wrapping everything in two (or three)
layers of no-value-added indirection, and remove some of the more
pointless/outdated idioms from the code.
2012-01-11 21:00:11 +01:00
Marijn Haverbeke
807592e99f Switch run_program over to ifaces 2012-01-11 20:33:44 +01:00
Marijn Haverbeke
4f76db43e6 Convert std::sha1 and std::rand over to ifaces 2012-01-11 20:33:44 +01:00
Marijn Haverbeke
26610dbbc8 Convert std::deque over to an iface 2012-01-11 20:33:44 +01:00
Marijn Haverbeke
15744210e7 Implement std::map as an iface/impl instead of an obj 2012-01-11 20:33:44 +01:00
Graydon Hoare
f6ecbe88ca Fix rpath bug. 2012-01-09 16:12:47 -08:00
Brian Anderson
fbad0204e4 Merge pull request #1470 from grahame/grahame
add new read_chars method, fix bug in read_char
2012-01-09 10:35:48 -08:00
Marijn Haverbeke
f30c5ea686 Remove leftover comm.rs in std
(The actual comm module lives in core.)
2012-01-09 14:53:13 +01:00
Grahame Bowland
ba694775f5 add tests for io::readchars and io::readchar
Additionally reformat so that 'make check' passes.
2012-01-09 20:49:17 +08:00
Brian Anderson
c5564c9bae Declare MIT license in crate attributes, not BSD
The Rust License is actually the MIT license, not BSD
2012-01-08 16:22:55 -08:00
Grahame Bowland
bcc25634e6 add new read_chars method, fix bug in read_char
having a read_chars method is convenient and more efficient.

the old read_char method had a bug due to re-use of the 'w' width
variable as a loop counter and so was broken for wide characters,
this patch fixes that.
2012-01-09 00:37:03 +08:00
Niko Matsakis
98f5109cde simplify task impl 2012-01-06 22:40:31 -08:00