Commit Graph

3320 Commits

Author SHA1 Message Date
Kevin Ballard 51470f3b97 c_str: Add new method .as_str() -> Option<&str>
Also rustify .as_bytes(), so it no longer calls libc::strlen() and is
inlineable.
2013-09-15 20:30:03 -07: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
Alex Crichton fd8c05ccc9 Document all of the format! related macros 2013-09-15 01:09:00 -07:00
Alex Crichton cfe3db810b Reduce the amount of complexity in format!
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-15 01:09:00 -07:00
Daniel Micay 48f61ecbf9 iter: add the edge case tests for range too 2013-09-15 00:54:32 -04:00
Daniel Micay 8149e5c99f rm some uses of the advance iterator method 2013-09-15 00:45:34 -04:00
blake2-ppc 6e3d5c62e7 std::num: Remove range_step for each numeric type
Replaced by `std::iter::range_step`
2013-09-15 00:41:41 -04:00
blake2-ppc ad74fde62f Use std::iter::range_step
Use the iterator version instead of the old uint::/int::range_step
functions.
2013-09-15 00:41:34 -04:00
Daniel Micay 66c2965b04 iter: fix RangeInclusive's DoubleEndedIterator 2013-09-15 00:39:34 -04:00
Daniel Micay bf7587f551 iter: fix range_inclusive when start > stop 2013-09-15 00:32:15 -04:00
Daniel Micay 1f961c74c4 fix range_step{,_inclusive} with negative step 2013-09-15 00:32:07 -04:00
bors 0dbd509e0f auto merge of #9199 : thestinger/rust/range_step, r=cmr
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-14 17:10:51 -07:00
Daniel Micay a18038f3b2 iter: add RangeStep and RangeStepInclusive 2013-09-14 18:26:21 -04:00
bors cf7e93ff25 auto merge of #9198 : FlaPer87/rust/shared-port, r=cmr
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-14 15:20:50 -07: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
Daniel Micay 3aead52586 iter: move Counter impl to the proper place 2013-09-14 16:51:55 -04:00
Daniel Micay 10c8978edb iter: replace comment with a docstring 2013-09-14 16:51:33 -04:00
Flavio Percoco 9357f8f4cd Add SharedPort wrapper around rt::comm::SharedPort
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-14 22:50:28 +02:00
Daniel Micay 561f1b0063 iter: fix range docstrings 2013-09-14 16:33:19 -04:00
bors bca015d9ff auto merge of #9182 : bjz/rust/master, r=brson
Somehow this was missed!

cc #4819
2013-09-14 11:15:54 -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 f853f0b2d6 auto merge of #9160 : alexcrichton/rust/local-data-docs, r=huonw
Remove references to local_data::Key and only mention the macro for how to
construct new keys into local data.
2013-09-14 02:30:59 -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
Alex Crichton 0af2bd829e Remove all usage of change_dir_locked
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-13 21:58:00 -07:00
Brendan Zabarauskas ec8f88417c Add Orderable bound to num::Primitive 2013-09-14 13:31:31 +10:00
blake2-ppc 830ac37ca2 std::logging: Use a more specific enum than Either 2013-09-14 04:07:43 +02:00
Erick Tryzelaar 93683ae6da std: Fix another windows problem with the unwrap_or_default rename 2013-09-13 07:09:32 -07:00
Erick Tryzelaar 28eb49bfbf std: rename Option.chain to Option.and_then on windows 2013-09-13 06:58:46 -07: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
Alex Crichton d0462f070c Improve the local_data docs slightly
Remove references to local_data::Key and only mention the macro for how to
construct new keys into local data.
2013-09-12 23:26:06 -07: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 7f9c5aae9e std: Restore Option::chain{,_mut}_ref as and_then{,_mut}_ref 2013-09-12 18:54:28 -07:00
Erick Tryzelaar f107718a9b std: Remove Zero impl for Option
Options are not numeric types, so it doesn't make sense for them to
implement Zero.
2013-09-12 18:54:13 -07:00
Erick Tryzelaar 43aba856b4 std: Remove Zero impl from vec
Vecs are not numeric types, so it doesn't make sense for them to
implement Zero.
2013-09-12 18:54:13 -07:00
Erick Tryzelaar ca47eebb44 std: Add a bunch of Default impls 2013-09-12 18:54:13 -07:00
Erick Tryzelaar 38f97ea103 std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else} 2013-09-12 18:54:13 -07:00
Erick Tryzelaar e03d60e9eb std: Add ToEither/IntoEither/AsEither 2013-09-12 18:54:12 -07:00
Erick Tryzelaar 12e0d7ecf0 std: Add ToResult/IntoResult/AsResult 2013-09-12 18:54:12 -07:00
Erick Tryzelaar ff34740a29 std: Add ToOption/IntoOption/AsOption 2013-09-12 18:54:12 -07:00
Erick Tryzelaar b8a284e873 std: fix a warning 2013-09-12 18:54:12 -07:00
Erick Tryzelaar d625d4a598 std: Add Option.{and,and_then,or,or_else} 2013-09-12 18:54:12 -07:00
Erick Tryzelaar 7380b1ce7f std: Add Option.unwrap_or_else and a couple tests 2013-09-12 18:54:12 -07:00
Erick Tryzelaar 2bd87ad432 std: Add Default implementation for vecs 2013-09-12 18:54:12 -07:00
Erick Tryzelaar e6c11313c8 std: Add Option.{result_or_default,or_default} that uses Default 2013-09-12 18:54:12 -07:00
Erick Tryzelaar 4a73c8eac7 std: add default implementations to Option 2013-09-12 18:54:12 -07:00
Erick Tryzelaar 653400a7f0 std: add default implementations to HashMap 2013-09-12 18:54:12 -07:00