Commit Graph

488 Commits

Author SHA1 Message Date
bors
0ec4d34b3f auto merge of #9211 : klutzy/rust/win32-fix, r=alexcrichton 2013-09-16 11:30:42 -07:00
Marvin Löbel
76c3e8a38c Add an SendStr type
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

Replaced std::rt:logging::SendableString with SendStr
Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-16 16:57:50 +02:00
klutzy
6d9c399ee2 std::rt::uv::file: Enable tests on Win32
Closes #8814.
2013-09-16 12:01:24 +09:00
klutzy
20e8470953 std::rt::uv::uvio: Enable tests on Win32
Closes #8816.
2013-09-16 10:31:36 +09:00
klutzy
3686c6cbcf std::rt::io::net::tcp: Fix one tcp test on Win32
Fixes `connect_error` part of #8811.
2013-09-16 03:45:20 +09:00
klutzy
879cfe6049 std::rt::uv::uvll: Fix uv_req_type on Win32
Also enables request_sanity_check() test.

Closes #8817
2013-09-16 03:33:29 +09:00
klutzy
1e745f1679 std::rt::io::support: Fix ignored test on Win32
Assumes drive C: exists.

Closes #8812.
2013-09-16 03:30:10 +09:00
klutzy
d2ce83ccb1 std::rt::io::file: Enable I/O tests on Win32
Enable blocked tests which are now fixed by #9165.

Closes #8810.
2013-09-15 23:20:33 +09:00
blake2-ppc
8522341274 Remove {uint,int,u64,i64,...}::from_str,from_str_radix
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.
2013-09-15 14:29:16 +02:00
bors
5c4f65e6f5 auto merge of #9191 : huonw/rust/are-you-tired, r=cmr
Allows `std::rt::io::timer::sleep(1000)` rather than `std::rt::io::timer::Timer::new().unwrap().sleep(1000)`.
2013-09-14 14:05:51 -07:00
bors
1c26513ef9 auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphism
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
2013-09-14 08:50:50 -07:00
Huon Wilson
f39ab75a78 std::rt: Add a standalone sleep function. 2013-09-15 00:20:48 +10:00
bors
55b43fa26e auto merge of #9165 : klutzy/rust/newrt-file-fix, r=sanxiyn
It was broken on win32 because of header inconsistency.
2013-09-14 05:00:56 -07:00
bors
fbafb41fff auto merge of #9156 : sfackler/rust/buffered-fix, r=huonw
This is a workaround for #9155. Currently, any uses of BufferedStream
outside of libstd ICE.
2013-09-14 01:16:00 -07:00
bors
2aa578efd9 auto merge of #9115 : erickt/rust/master, r=erickt
This is a series of patches to modernize option and result. The highlights are:

* rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)`
* add `.unwrap_or_default()` that uses the `Default` trait
* add `Default` implementations for vecs, HashMap, Option
* add  `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>`
* add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither`
* renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`.
* Added a bunch of impls of `Default`
* Added a `#[deriving(Default)]` syntax extension
* Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-14 00:01:04 -07:00
blake2-ppc
830ac37ca2 std::logging: Use a more specific enum than Either 2013-09-14 04:07:43 +02:00
klutzy
3924cb031f std::rt::io: Fix file I/O on Win32
It was broken on win32 because of header inconsistency.
2013-09-13 19:23:57 +09:00
bors
323e8f07ff auto merge of #9087 : fhahn/rust/rust_crate_map, r=brson
This patch converts the rust_crate_map.cpp to Rust as mentioned at the end of #8880.
2013-09-12 23:00:51 -07:00
Steven Fackler
ef964a162f Stop using newtypes in rt::io::buffered
This is a workaround for #9155. Currently, any uses of BufferedStream
outside of libstd ICE.
2013-09-12 21:48:47 -07:00
Erick Tryzelaar
38f97ea103 std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else} 2013-09-12 18:54:13 -07:00
Florian Hahn
2b5f4b55c0 Convert rust_crate_map.cpp to Rust
Conflicts:
	src/libstd/rt/logging.rs
2013-09-13 00:47:30 +02:00
bors
03ca1befb3 auto merge of #9114 : sfackler/rust/flush-fix, r=brson 2013-09-11 23:11:04 -07:00
bors
c8f69dd2a4 auto merge of #9038 : singingboyo/rust/with-mem-writer, r=anasazi
This is in many ways a replacement for the current std::io::with_str_writer.
2013-09-11 12:16:01 -07:00
bors
f711650b8d auto merge of #8999 : anasazi/rust/multi-threaded-io-tests, r=brson
Resolves #8685
2013-09-11 10:21:02 -07:00
Steven Fackler
412ab49557 Don't fail in TcpStream.flush 2013-09-10 21:43:47 -07:00
Steven Fackler
71f0305cf1 Buffered I/O wrappers
The default buffer size is the same as the one in Java's BufferedWriter.

We may want BufferedWriter to have a Drop impl that flushes, but that
isn't possible right now due to #4252/#4430. This would be a bit
awkward due to the possibility of the inner flush failing. For what it's
worth, Java's BufferedReader doesn't have a flushing finalizer, but that
may just be because Java's finalizer support is awful.

Closes #8953
2013-09-10 21:26:28 -07:00
Brandon Sanderson
5478ebb553 Add with_mem_writer to std::rt::io::mem.
This is in many ways a replacement for the current
std::io::with_str_writer.
2013-09-06 21:21:59 -07:00
Eric Reed
6840076cd9 Make I/O tests use run_in_mt_newsched_task to get more multi-threaded test coverage 2013-09-06 11:13:43 -07:00
Eric Reed
73bb4de556 Forgot to make accept() home for IO 2013-09-06 11:13:43 -07:00
Alex Crichton
b4c36c2d1b Upgrade libuv to the current master (again)
This is a reopening of the libuv-upgrade part of #8645. Hopefully this won't
cause random segfaults all over the place. The windows regression in testing
should also be fixed (it shouldn't build the whole compiler twice).

A notable difference from before is that gyp is now a git submodule instead of
always git-cloned at make time. This allows bundling for releases more easily.

Closes #8850
2013-09-06 11:12:49 -07:00
Eric Reed
8f0721bcb8 Fix Acceptor iterator ending early if a connection attempt fails 2013-09-06 05:30:41 -07:00
Daniel Micay
6919cf5fe1 rename std::iterator to std::iter
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
novalis
c684df103e Handle global log levels (fixes #6033) 2013-09-07 09:14:52 -04:00
novalis
c891fa326d Fix #6031. Allow symbolic log levels, not just numbers. 2013-09-06 23:30:17 -04:00
bors
25ed29a0ed auto merge of #9000 : brson/rust/dns, r=anasazi
This exposes a very simple function for resolving host names. There's a lot more that needs to be done, but this is probably enough for servo to get started connecting to real websites again.
2013-09-06 02:31:02 -07:00
Brian Anderson
807408b708 std::rt: Fix addrinfo definition on BSD 2013-09-05 22:15:02 -07:00
bors
6f9ce0948a auto merge of #8997 : fhahn/rust/issue_8985, r=catamorphism,brson
Patch for #8985
2013-09-05 15:00:49 -07:00
Brian Anderson
0948f54e65 std::rt: Add get_host_addresses function
This is a very simplistic method for host name resolution. It converts
a host name to a vector of IP addresses. Should be enough to get started.
2013-09-05 14:22:16 -07:00
Brian Anderson
c218694cec std::rt: Add libuv bindings for getaddrinfo 2013-09-05 14:22:15 -07:00
Brian Anderson
b3f7f758b1 std::rt: Some I/O cleanup 2013-09-05 14:21:57 -07:00
Florian Hahn
de39874801 Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
Chris Morgan
da042ce46a Implement Stream automatically for Reader + Writer
This is consistent with the existing documentation but was not the
actual behaviour, which I've found to be rather a nuisance, actually.
2013-09-05 10:52:18 +10:00
bors
b161e09e03 auto merge of #8977 : pnkfelix/rust/fsk-followup-on-6009-rebased, r=alexcrichton
Fix #6009.  Rebased version of #8970.  Inherits review from alexcrichton.
2013-09-04 16:20:46 -07:00
bors
6c13b0f4f6 auto merge of #8935 : blake2-ppc/rust/reader-bytes, r=brson
An iterator that simply calls `.read_bytes()` each iteration.

I think choosing to own the Reader value and implementing Decorator to
allow extracting it is the most generically useful. The Reader type
variable can of course be some kind of reference type that implements
Reader.

In the generic form the `Bytes` iterator is well behaved itself and does not read ahead.
It performs abysmally on top of a FileStream, and much better if a buffering reader is inserted inbetween.
2013-09-04 14:20:46 -07:00
bors
60fba4d7d6 auto merge of #8880 : fhahn/rust/issue_8703, r=brson
I've started working on #8703.

RUST_LOG="::help" should work, I hope I'll be able to finish the rest this weekend.
2013-09-04 13:05:50 -07:00
Florian Hahn
e38739bb44 Convert rust_log.cpp to Rust, closes #8703 2013-09-04 14:18:56 +02:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
Felix S. Klock II
83e19d2ead Added explicit pub to several conditions. Enables completion of #6009. 2013-09-04 10:03:47 +02:00
bors
1611e7b72a auto merge of #8943 : alexcrichton/rust/issue-8904, r=brson
We already do this for libstd tests automatically, and compiletest runs into the
same problems where when forking lots of processes lots of file descriptors are
created. On OSX we can use specific syscalls to raise the limits, in this
situation, though.

Closes #8904
2013-09-03 22:05:59 -07:00
bors
383073883f auto merge of #8963 : jmgrosen/rust/issue-8881, r=alexcrichton 2013-09-03 19:46:42 -07:00