summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-09-16auto merge of #9211 : klutzy/rust/win32-fix, r=alexcrichtonbors-26/+47
2013-09-16std::str: Add bench tests for StrVector::connect() and for str::push_strblake2-ppc-0/+19
2013-09-16std::vec: Add function vec::bytes::push_bytesblake2-ppc-0/+17
`push_bytes` is implemented with `ptr::copy_memory` here since this function is intended to be used to implement `.push_str()` for str, so we want to avoid the overhead.
2013-09-16std::vec: Fix hazards with uint overflows in unsafe codeblake2-ppc-6/+29
Issue #8742 Add the method `.reserve_additional(n: uint)`: Check for overflow in self.len() + n, and reserve that many elements (rounded up to next power of two). Does nothing if self.len() + n < self.capacity() already.
2013-09-16auto merge of #9192 : Kimundi/rust/master, r=huonwbors-16/+278
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. This basically reimplements #7599 and has a use case for replacing an similar type in `std::rt::logging` ( Added in #9180).
2013-09-16Corrected a few small style issuesMarvin Löbel-18/+43
Split up test function a bit
2013-09-16Add an SendStr typeMarvin Löbel-16/+253
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-16std::num: Add uint::next_power_of_two_optblake2-ppc-1/+11
Like next_power_of_two, but returns None on overflow.
2013-09-15c_str: Add new method .as_str() -> Option<&str>Kevin Ballard-3/+74
Also rustify .as_bytes(), so it no longer calls libc::strlen() and is inlineable.
2013-09-16std::rt::uv::file: Enable tests on Win32klutzy-2/+0
Closes #8814.
2013-09-16std::rt::uv::uvio: Enable tests on Win32klutzy-2/+0
Closes #8816.
2013-09-16std::rt::io::net::tcp: Fix one tcp test on Win32klutzy-2/+7
Fixes `connect_error` part of #8811.
2013-09-16std::rt::uv::uvll: Fix uv_req_type on Win32klutzy-3/+27
Also enables request_sanity_check() test. Closes #8817
2013-09-16std::os: Use unicode for last_os_error() on Win32klutzy-10/+9
FormatMessageA may return non-ascii message, which is encoded as system code page, not utf8. This may cause `assert!(is_utf8(v))` failure on some non-English machines. This patch replaces it with FormatMessageW, which returns utf-16 message. Fixes `make check-stage2-std` failure on my machine. :)
2013-09-16std::rt::io::support: Fix ignored test on Win32klutzy-2/+1
Assumes drive C: exists. Closes #8812.
2013-09-15std::rt::io::file: Enable I/O tests on Win32klutzy-5/+3
Enable blocked tests which are now fixed by #9165. Closes #8810.
2013-09-15Remove {uint,int,u64,i64,...}::from_str,from_str_radixblake2-ppc-93/+69
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-15Document all of the format! related macrosAlex Crichton-2/+74
2013-09-15Reduce the amount of complexity in format!Alex Crichton-0/+7
This renames the syntax-extension file to format from ifmt, and it also reduces the amount of complexity inside by defining all other macros in terms of format_args!
2013-09-15iter: add the edge case tests for `range` tooDaniel Micay-0/+10
2013-09-15rm some uses of the `advance` iterator methodDaniel Micay-2/+2
2013-09-15std::num: Remove `range_step` for each numeric typeblake2-ppc-296/+0
Replaced by `std::iter::range_step`
2013-09-15Use std::iter::range_stepblake2-ppc-35/+27
Use the iterator version instead of the old uint::/int::range_step functions.
2013-09-15iter: fix `RangeInclusive`'s `DoubleEndedIterator`Daniel Micay-3/+5
2013-09-15iter: fix `range_inclusive` when `start > stop`Daniel Micay-4/+10
2013-09-15fix range_step{,_inclusive} with negative stepDaniel Micay-16/+10
2013-09-14auto merge of #9199 : thestinger/rust/range_step, r=cmrbors-14/+101
My focus was on getting these to be correct in all cases by handling overflow properly. I'll clean them up and work on the performance later.
2013-09-14iter: add `RangeStep` and `RangeStepInclusive`Daniel Micay-1/+90
2013-09-14auto merge of #9198 : FlaPer87/rust/shared-port, r=cmrbors-9/+38
SharedPort implementation was missing in std::comm. Since this module also wraps SharedChan, it makes sense to have SharedPort defined there as well.
2013-09-14auto merge of #9191 : huonw/rust/are-you-tired, r=cmrbors-0/+14
Allows `std::rt::io::timer::sleep(1000)` rather than `std::rt::io::timer::Timer::new().unwrap().sleep(1000)`.
2013-09-14iter: move Counter impl to the proper placeDaniel Micay-14/+14
2013-09-14iter: replace comment with a docstringDaniel Micay-5/+3
2013-09-14Add SharedPort wrapper around rt::comm::SharedPortFlavio Percoco-9/+38
SharedPort implementation was missing in std::comm. Since this module also wraps SharedChan, it makes sense to have SharedPort defined there as well.
2013-09-14iter: fix range docstringsDaniel Micay-2/+2
2013-09-14auto merge of #9182 : bjz/rust/master, r=brsonbors-0/+1
Somehow this was missed! cc #4819
2013-09-14auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphismbors-18/+18
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-15std::rt: Add a standalone sleep function.Huon Wilson-0/+14
2013-09-14auto merge of #9165 : klutzy/rust/newrt-file-fix, r=sanxiynbors-0/+9
It was broken on win32 because of header inconsistency.
2013-09-14auto merge of #9160 : alexcrichton/rust/local-data-docs, r=huonwbors-7/+8
Remove references to local_data::Key and only mention the macro for how to construct new keys into local data.
2013-09-14auto merge of #9156 : sfackler/rust/buffered-fix, r=huonwbors-13/+19
This is a workaround for #9155. Currently, any uses of BufferedStream outside of libstd ICE.
2013-09-14auto merge of #9115 : erickt/rust/master, r=ericktbors-98/+833
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-13Remove all usage of change_dir_lockedAlex Crichton-53/+0
While usage of change_dir_locked is synchronized against itself, it's not synchronized against other relative path usage, so I'm of the opinion that it just really doesn't help in running tests. In order to prevent the problems that have been cropping up, this completely removes the function. All existing tests (except one) using it have been moved to run-pass tests where they get their own process and don't need to be synchronized with anyone else. There is one now-ignored rustpkg test because when I moved it to a run-pass test apparently run-pass isn't set up to have 'extern mod rustc' (it ends up having linkage failures).
2013-09-14Add Orderable bound to num::PrimitiveBrendan Zabarauskas-0/+1
2013-09-14std::logging: Use a more specific enum than Eitherblake2-ppc-18/+18
2013-09-13std: Fix another windows problem with the unwrap_or_default renameErick Tryzelaar-1/+1
2013-09-13std: rename Option.chain to Option.and_then on windowsErick Tryzelaar-1/+1
2013-09-13std::rt::io: Fix file I/O on Win32klutzy-0/+9
It was broken on win32 because of header inconsistency.
2013-09-12Improve the local_data docs slightlyAlex Crichton-7/+8
Remove references to local_data::Key and only mention the macro for how to construct new keys into local data.
2013-09-12auto merge of #9087 : fhahn/rust/rust_crate_map, r=brsonbors-54/+224
This patch converts the rust_crate_map.cpp to Rust as mentioned at the end of #8880.
2013-09-12Stop using newtypes in rt::io::bufferedSteven Fackler-13/+19
This is a workaround for #9155. Currently, any uses of BufferedStream outside of libstd ICE.