about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-05-13auto merge of #14075 : Rufflewind/rust/patch-3, r=alexcrichtonbors-10/+36
- Use Unicode-aware versions of `CreateProcess` (Fixes #13815) and `Get/FreeEnvironmentStrings`. - Includes a helper function `os::win32::as_mut_utf16_p`, which does the same thing as `os::win32::as_utf16_p` except the pointer is mutable. - Fixed `make_command_line` to handle Unicode correctly. - Tests for the above.
2014-05-13Use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsAPhil Ruffwind-9/+31
Changed libstd to use Get/FreeEnvironmentStringsW instead of Get/FreeEnvironmentStringsA to support Unicode environment variables.
2014-05-13Use CreateProcessW instead of CreateProcessAPhil Ruffwind-1/+5
Changed libnative to use CreateProcessW instead of CreateProcessA. In addition, the lpEnvironment parameter now uses Unicode. Added a helper function os::win32::as_mut_utf16_p, which does basically the same thing as os::win32::as_utf16_p except the pointer is mutable.
2014-05-13Added functions pop_char and shift_char to StrBuf struct along with ↵Dylan Braithwaite-4/+57
appropriate unit tests, using the same test case as push_char. Changed StrBuf.shift_byte() that it no longer reallocates the buffer by just calling Vec.shift(); Added warning to shift_char()'s docs about it having to copy the whole buffer, as per the docs for Vec.shift().
2014-05-12auto merge of #13919 : thomaslee/rust/thomaslee_proposed_tcpstream_open, ↵bors-96/+264
r=alexcrichton Been meaning to try my hand at something like this for a while, and noticed something similar mentioned as part of #13537. The suggestion on the original ticket is to use `TcpStream::open(&str)` to pass in a host + port string, but seems a little cleaner to pass in host and port separately -- so a signature like `TcpStream::open(&str, u16)`. Also means we can use std::io::net::addrinfo directly instead of using e.g. liburl to parse the host+port pair from a string. One outstanding issue in this PR that I'm not entirely sure how to address: in open_timeout, the timeout_ms will apply for every A record we find associated with a hostname -- probably not the intended behavior, but I didn't want to waste my time on elaborate alternatives until the general idea was a-OKed. :) Anyway, perhaps there are other reasons for us to prefer the original proposed syntax, but thought I'd get some thoughts on this. Maybe there are some solid reasons to prefer using liburl to do this stuff.
2014-05-12Document a possible way in which connect_timout may change in the futureTom Lee-0/+3
2014-05-12Try to parse TcpStream::connect 'host' parameter as an IP.Tom Lee-1/+4
Fall back to get_host_addresses to try a DNS lookup if we can't parse it as an IP address.
2014-05-12Easier interface for TCP ::connect and ::bind.Tom Lee-96/+258
Prior to this commit, TcpStream::connect and TcpListener::bind took a single SocketAddr argument. This worked well enough, but the API felt a little too "low level" for most simple use cases. A great example is connecting to rust-lang.org on port 80. Rust users would need to: 1. resolve the IP address of rust-lang.org using io::net::addrinfo::get_host_addresses. 2. check for errors 3. if all went well, use the returned IP address and the port number to construct a SocketAddr 4. pass this SocketAddr to TcpStream::connect. I'm modifying the type signature of TcpStream::connect and TcpListener::bind so that the API is a little easier to use. TcpStream::connect now accepts two arguments: a string describing the host/IP of the host we wish to connect to, and a u16 representing the remote port number. Similarly, TcpListener::bind has been modified to take two arguments: a string describing the local interface address (e.g. "0.0.0.0" or "127.0.0.1") and a u16 port number. Here's how to port your Rust code to use the new TcpStream::connect API: // old ::connect API let addr = SocketAddr{ip: Ipv4Addr{127, 0, 0, 1}, port: 8080}; let stream = TcpStream::connect(addr).unwrap() // new ::connect API (minimal change) let addr = SocketAddr{ip: Ipv4Addr{127, 0, 0, 1}, port: 8080}; let stream = TcpStream::connect(addr.ip.to_str(), addr.port()).unwrap() // new ::connect API (more compact) let stream = TcpStream::connect("127.0.0.1", 8080).unwrap() // new ::connect API (hostname) let stream = TcpStream::connect("rust-lang.org", 80) Similarly, for TcpListener::bind: // old ::bind API let addr = SocketAddr{ip: Ipv4Addr{0, 0, 0, 0}, port: 8080}; let mut acceptor = TcpListener::bind(addr).listen(); // new ::bind API (minimal change) let addr = SocketAddr{ip: Ipv4Addr{0, 0, 0, 0}, port: 8080}; let mut acceptor = TcpListener::bind(addr.ip.to_str(), addr.port()).listen() // new ::bind API (more compact) let mut acceptor = TcpListener::bind("0.0.0.0", 8080).listen() [breaking-change]
2014-05-12Test fixes from rollupAlex Crichton-3/+1
Closes #14163 (Fix typos in rustc manpage) Closes #14161 (Add the patch number to version strings. Closes #13289) Closes #14156 (rustdoc: Fix hiding implementations of traits) Closes #14152 (add shebang to scripts that have execute bit set) Closes #14150 (libcore: remove fails from slice.rs and remove duplicated length checking) Closes #14147 (Make ProcessOutput Eq, TotalEq, Clone) Closes #14142 (doc: updates rust manual (loop to continue)) Closes #14141 (doc: Update the linkage documentation) Closes #14139 (Remove an unnecessary .move_iter().collect()) Closes #14136 (Two minor fixes in parser.rs) Closes #14130 (Fixed typo in comments of driver.rs) Closes #14128 (Add `stat` method to `std::io::fs::File` to stat without a Path.) Closes #14114 (rustdoc: List macros in the sidebar) Closes #14113 (shootout-nbody improvement) Closes #14112 (Improved example code in Option) Closes #14104 (Remove reference to MutexArc) Closes #14087 (emacs: highlight `macro_name!` in macro invocations using [] delimiters)
2014-05-12Improved example code in OptionAdolfo Ochagavía-12/+15
2014-05-12Add `stat` method to `std::io::fs::File` to stat without a Path.Yuri Kunde Schlesner-9/+15
The `FileStat` struct contained a `path` field, which was filled by the `stat` and `lstat` function. Since this field isn't in fact returned by the operating system (it was copied from the paths passed to the functions) it was removed, as in the `fstat` case we aren't working with a `Path`, but directly with a fd. If your code used the `path` field of `FileStat` you will now have to manually store the path passed to `stat` along with the returned struct. [breaking-change]
2014-05-12Remove an unnecessary .move_iter().collect()Simon Sapin-1/+1
2014-05-12Make ProcessOutput Eq, TotalEq, CloneYehuda Katz-0/+1
2014-05-12Add the patch number to version strings. Closes #13289Brian Anderson-1/+1
2014-05-12librustc: Remove all uses of `~str` from librustc.Patrick Walton-0/+22
2014-05-12register snapshotsDaniel Micay-84/+2
2014-05-11auto merge of #14119 : thestinger/rust/heap, r=cmrbors-24/+33
2014-05-11auto merge of #14110 : SSheldon/rust/strbuf_mutable, r=alexcrichtonbors-1/+17
Despite implementing the Container trait, StrBuf did not implement the Mutable trait and had no clear method; this request implements the clear method of the Mutable trait for StrBuf. Testing done: added a test and ran `make check` without any failures.
2014-05-11heap: replace `exchange_free` with `deallocate`Daniel Micay-17/+12
The `std::rt::heap` API is Rust's global allocator, so there's no need to have this as a separate API.
2014-05-11heap: add a way to print allocator statisticsDaniel Micay-2/+16
2014-05-11mark rust_malloc/rust_free as unsafeDaniel Micay-6/+6
Support for this was added by 08237cad8d2ce9287aedf99e57384407cc9dc42d.
2014-05-11sync::deque: port to the new allocator APIDaniel Micay-15/+19
2014-05-11Implement Mutable trait for StrBuf.Steven Sheldon-1/+17
2014-05-11core: Remove the cast moduleAlex Crichton-253/+258
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-11android workaroundDaniel Micay-1/+1
2014-05-10rename `global_heap` -> `libc_heap`Daniel Micay-10/+9
This module only contains wrappers for malloc and realloc with out-of-memory checks.
2014-05-10vec: factor out some deallocation codeDaniel Micay-9/+12
2014-05-10vec: move some code inside alloc_or_reallocDaniel Micay-7/+5
2014-05-10fix Vec<ZeroSizeType>Daniel Micay-2/+15
2014-05-10initial port of the exchange allocator to jemallocDaniel Micay-142/+205
In stage0, all allocations are 8-byte aligned. Passing a size and alignment to free is not yet implemented everywhere (0 size and 8 align are used as placeholders). Fixing this is part of #13994. Closes #13616
2014-05-10use jemalloc to implement Vec<T>Daniel Micay-27/+49
2014-05-10add an align parameter to exchange_mallocDaniel Micay-1/+44
Closes #13094
2014-05-10add back jemalloc to the treeDaniel Micay-1/+101
This adds a `std::rt::heap` module with a nice allocator API. It's a step towards fixing #13094 and is a starting point for working on a generic allocator trait. The revision used for the jemalloc submodule is the stable 3.6.0 release. Closes #11807
2014-05-10auto merge of #14073 : alexcrichton/rust/snapshots, r=huonwbors-42/+5
2014-05-10auto merge of #14068 : alexcrichton/rust/rustdoc-xcrate-links, r=brsonbors-8/+8
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-09Register new snapshotsAlex Crichton-42/+5
2014-05-09doc: Fix some broken linksAlex Crichton-8/+8
2014-05-09auto merge of #14054 : luqmana/rust/at, r=alexcrichtonbors-7/+9
`/data/local/tmp` seems to be more common.
2014-05-09auto merge of #14046 : alexcrichton/rust/ignore-a-test-on-freebsd, r=kballardbors-13/+18
This test runs successfully manually, but the bots are having trouble getting this test to pass. Ignore it on freebsd for now.
2014-05-09auto merge of #14035 : alexcrichton/rust/experimental, r=huonwbors-0/+9
This was intended as part of the I/O timeouts commit, but it was mistakenly forgotten. The type of the timeout argument is not guaranteed to remain constant into the future.
2014-05-08auto merge of #14019 : brson/rust/docs, r=alexcrichtonbors-3/+4
Just small bits of polish.
2014-05-08auto merge of #13963 : kballard/rust/remove_owned_vec_from_iterator, r=pcwaltonbors-418/+510
With `~[T]` no longer growable, the `FromIterator` impl for `~[T]` doesn't make much sense. Not only that, but nearly everywhere it is used is to convert from a `Vec<T>` into a `~[T]`, for the sake of maintaining existing APIs. This turns out to be a performance loss, as it means every API that returns `~[T]`, even a supposedly non-copying one, is in fact doing extra allocations and memcpy's. Even `&[T].to_owned()` is going through `Vec<T>` first. Remove the `FromIterator` impl for `~[T]`, and adjust all the APIs that relied on it to start using `Vec<T>` instead. This includes rewriting `&[T].to_owned()` to be more efficient, among other performance wins. Also add a new mechanism to go from `Vec<T>` -> `~[T]`, just in case anyone truly needs that, using the new trait `FromVec`. [breaking-change]
2014-05-08libstd: Check TMPDIR for android as well and if not set use ↵Luqman Aden-7/+9
'/data/local/tmp' instead of '/data/tmp'.
2014-05-08auto merge of #13985 : alexcrichton/rust/libfmt, r=brsonbors-1009/+80
This code does not belong in libstd, and rather belongs in a dedicated crate. In the future, the syntax::ext::format module should move to the fmt_macros crate (hence the name of the crate), but for now the fmt_macros crate will only contain the format string parser. The entire fmt_macros crate is marked #[experimental] because it is not meant for general consumption, only the format!() interface is officially supported, not the internals. This is a breaking change for anyone using the internals of std::fmt::parse. Some of the flags have moved to std::fmt::rt, while the actual parsing support has all moved to the fmt_macros library. [breaking-change]
2014-05-08Move partition/partitioned/concat/connect tests back into sliceKevin Ballard-26/+40
There was no reason to remove them from slice. They're testing methods defined in slice, so that's where they belong. Leave vec with copies of the partition/partitioned tests because it has its own implementation of those methods.
2014-05-08Handle breakage after libcore splitKevin Ballard-55/+28
API Changes: - &[T] and ~[T] no longer support the addition operator (+)
2014-05-08Add a mechanism to convert from Vec<T> to ~[T]Kevin Ballard-1/+73
Add a new trait FromVec with one self-less method from_vec(). This is kind of like FromIterator, but it consumes a Vec<T>. It's only implemented for ~[T], but the idea is post-DST it can be implemented for any Boxed<[T]>.
2014-05-08Handle fallout in documentationKevin Ballard-1/+1
Tweak the tutorial's section on vectors and strings, to slightly clarify the difference between fixed-size vectors, vectors, and slices.
2014-05-08Handle more falloutKevin Ballard-0/+3
os::args() no longer auto-borrows to &[~str].
2014-05-08Clean up unused importsKevin Ballard-12/+5