about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2014-12-22Test fixes and rebase conflictsAlex Crichton-1/+1
2014-12-22rollup merge of #19891: nikomatsakis/unique-fn-types-3Alex Crichton-0/+4
Conflicts: src/libcore/str.rs src/librustc_trans/trans/closure.rs src/librustc_typeck/collect.rs src/libstd/path/posix.rs src/libstd/path/windows.rs
2014-12-22rollup merge of #20056: MrFloya/iter_renameAlex Crichton-28/+27
Conflicts: src/libcollections/bit.rs src/libcore/str.rs
2014-12-22rollup merge of #20140: frewsxcv/rm-reexportsAlex Crichton-1/+2
Part of #19253 I would have removed this public reexport in #19842, but #19812 hadn't merged (and snapshotted) at the time In #19407, I changed the codebase to stop utilizing this reexport [breaking-change]
2014-12-22Remove cmp::Ordering::* public reexportCorey Farwell-1/+2
Part of #19253 I would have removed this public reexport in #19842, but #19812 hadn't merged (and snapshotted) at the time In #19407, I changed the codebase to stop utilizing this reexport [breaking-change]
2014-12-22Correct merge failure around imports in `str.rs`.Niko Matsakis-2/+1
2014-12-22Insert coercions to fn pointer types required for the new typesNiko Matsakis-0/+4
post-unboxed-closure-conversion. This requires a fair amount of annoying coercions because all the `map` etc types are defined generically over the `F`, so the automatic coercions don't propagate; this is compounded by the need to use `let` and not `as` due to stage0. That said, this pattern is to a large extent temporary and unusual.
2014-12-22Fix fallout from changes. In cases where stage0 compiler is needed, weNiko Matsakis-0/+1
cannot use an `as` expression to coerce, so I used a one-off function instead (this is a no-op in stage0, but in stage1+ it triggers coercion from the fn pointer to the fn item type).
2014-12-22Added missing renames:Florian Wilkens-1/+1
libcollections: AbsEntries -> AbsIter, Entries -> Iter, MoveEntries -> IntoIter, MutEntries -> IterMut DifferenceItems -> Difference, SymDifferenceItems -> SymmetricDifference, IntersectionItems -> Intersection, UnionItems -> Union libstd/hash/{table, map}: Entries -> Iter, MoveItems -> IntoIter, MutEntries -> IterMut Also a [breaking-change].
2014-12-22Renaming of the Iter types as in RFC #344Florian Wilkens-31/+30
libcore: slice::Items -> slice::Iter, slice::MutItems -> slice::IterMut libcollections: *::Items -> *::Iter, *::MoveItems -> *::IntoIter, *::MutItems -> *::IterMut This is of course a [breaking-change].
2014-12-21Fallout of std::str stabilizationAlex Crichton-27/+17
2014-12-21std: Stabilize the std::str moduleAlex Crichton-884/+147
This commit starts out by consolidating all `str` extension traits into one `StrExt` trait to be included in the prelude. This means that `UnicodeStrPrelude`, `StrPrelude`, and `StrAllocating` have all been merged into one `StrExt` exported by the standard library. Some functionality is currently duplicated with the `StrExt` present in libcore. This commit also currently avoids any methods which require any form of pattern to operate. These functions will be stabilized via a separate RFC. Next, stability of methods and structures are as follows: Stable * from_utf8_unchecked * CowString - after moving to std::string * StrExt::as_bytes * StrExt::as_ptr * StrExt::bytes/Bytes - also made a struct instead of a typedef * StrExt::char_indices/CharIndices - CharOffsets was renamed * StrExt::chars/Chars * StrExt::is_empty * StrExt::len * StrExt::lines/Lines * StrExt::lines_any/LinesAny * StrExt::slice_unchecked * StrExt::trim * StrExt::trim_left * StrExt::trim_right * StrExt::words/Words - also made a struct instead of a typedef Unstable * from_utf8 - the error type was changed to a `Result`, but the error type has yet to prove itself * from_c_str - this function will be handled by the c_str RFC * FromStr - this trait will have an associated error type eventually * StrExt::escape_default - needs iterators at least, unsure if it should make the cut * StrExt::escape_unicode - needs iterators at least, unsure if it should make the cut * StrExt::slice_chars - this function has yet to prove itself * StrExt::slice_shift_char - awaiting conventions about slicing and shifting * StrExt::graphemes/Graphemes - this functionality may only be in libunicode * StrExt::grapheme_indices/GraphemeIndices - this functionality may only be in libunicode * StrExt::width - this functionality may only be in libunicode * StrExt::utf16_units - this functionality may only be in libunicode * StrExt::nfd_chars - this functionality may only be in libunicode * StrExt::nfkd_chars - this functionality may only be in libunicode * StrExt::nfc_chars - this functionality may only be in libunicode * StrExt::nfkc_chars - this functionality may only be in libunicode * StrExt::is_char_boundary - naming is uncertain with container conventions * StrExt::char_range_at - naming is uncertain with container conventions * StrExt::char_range_at_reverse - naming is uncertain with container conventions * StrExt::char_at - naming is uncertain with container conventions * StrExt::char_at_reverse - naming is uncertain with container conventions * StrVector::concat - this functionality may be replaced with iterators, but it's not certain at this time * StrVector::connect - as with concat, may be deprecated in favor of iterators Deprecated * StrAllocating and UnicodeStrPrelude have been merged into StrExit * eq_slice - compiler implementation detail * from_str - use the inherent parse() method * is_utf8 - call from_utf8 instead * replace - call the method instead * truncate_utf16_at_nul - this is an implementation detail of windows and does not need to be exposed. * utf8_char_width - moved to libunicode * utf16_items - moved to libunicode * is_utf16 - moved to libunicode * Utf16Items - moved to libunicode * Utf16Item - moved to libunicode * Utf16Encoder - moved to libunicode * AnyLines - renamed to LinesAny and made a struct * SendStr - use CowString<'static> instead * str::raw - all functionality is deprecated * StrExt::into_string - call to_string() instead * StrExt::repeat - use iterators instead * StrExt::char_len - use .chars().count() instead * StrExt::is_alphanumeric - use .chars().all(..) * StrExt::is_whitespace - use .chars().all(..) Pending deprecation -- while slicing syntax is being worked out, these methods are all #[unstable] * Str - while currently used for generic programming, this trait will be replaced with one of [], deref coercions, or a generic conversion trait. * StrExt::slice - use slicing syntax instead * StrExt::slice_to - use slicing syntax instead * StrExt::slice_from - use slicing syntax instead * StrExt::lev_distance - deprecated with no replacement Awaiting stabilization due to patterns and/or matching * StrExt::contains * StrExt::contains_char * StrExt::split * StrExt::splitn * StrExt::split_terminator * StrExt::rsplitn * StrExt::match_indices * StrExt::split_str * StrExt::starts_with * StrExt::ends_with * StrExt::trim_chars * StrExt::trim_left_chars * StrExt::trim_right_chars * StrExt::find * StrExt::rfind * StrExt::find_str * StrExt::subslice_offset
2014-12-21rollup merge of #19972: alexcrichton/snapshotsAlex Crichton-437/+0
Conflicts: src/libcollections/string.rs src/libcollections/vec.rs src/snapshots.txt
2014-12-21rollup merge of #20070: aturon/stab-2-cloneAlex Crichton-12/+26
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`. r? @alexcrichton
2014-12-21rollup merge of #20066: aturon/stab-2-cellAlex Crichton-19/+13
This patch finalizes stabilization for the `cell` module, settling on the current names `Cell`, `RefCell`, `UnsafeCell`, `Ref` and `RefMut`. While we had considered improving these names, no one was able to produce a truly compelling alternative. There is one substantive change here: the `get` method of `UnsafeSell` is now marked `unsafe`. Merely getting a raw pointer to the contents is not, by itself, an unsafe operation. (Consider that you can always safely turn a reference into a raw pointer, and that raw pointer may then be aliased by subsequent references.) r? @alexcrichton
2014-12-21rollup merge of #20062: aturon/stab-2-intsAlex Crichton-10/+6
This small patch stabilizes the names of all integer modules (including `int` and `uint`) and the `MIN` and `MAX` constants. The `BITS` and `BYTES` constants are left unstable for now. r? @alexcrichton
2014-12-21rollup merge of #20014: kballard/unsized-marker-type-paramsAlex Crichton-10/+20
Tweak CovariantType, ContravariantType, and InvariantType to allow their type parameter to be unsized.
2014-12-21rollup merge of #20006: alexcrichton/no-more-empty-modulesAlex Crichton-70/+1
This commit modifies rustdoc to not require these empty modules to be public in the standard library. The modules still remain as a location to attach documentation to, but the modules themselves are now private (don't have to commit to an API). The documentation for the standard library now shows all of the primitive types on the main index page.
2014-12-21rollup merge of #19961: alexcrichton/second-pass-resultAlex Crichton-54/+90
This commit, like the second pass of `Option`, largely just stablizes the existing functionality after renaming a few iterators. The specific actions taken were: * The `Ok` and `Err` variants were marked `#[stable]` as the stability inheritance was since removed. * The `as_mut` method is now stable. * The `map` method is now stable * The `map_err` method is now stable * The `iter`, `iter_mut`, and `into_iter` methods now returned structures named after the method of iteration. The methods are also now all stable. * The `and_then` method is now stable. * The `or_else` method is now stable. * The `unwrap` family of functions are now all stable: `unwrap_or`, `unwrap_or_else`, `unwrap`, and `unwrap_err`. There is a possible open extension to `Result::{and, and_then}` to make the return type further generic over `FromError` (as proposed in #19078), but this is a backwards compatible change due to the usage of default type parameters, which makes the two functions safe to stabilize now regardless of the outcome of that issue.
2014-12-21rollup merge of #19838: shepmaster/invariant-lifetime-copyAlex Crichton-3/+1
Both ContravariantLifetime and CovariantLifetime are marked as Copy, so it makes sense for InvariantLifetime to be as well.
2014-12-21rollup merge of #19651: Gankro/ptr-docsAlex Crichton-40/+94
r? @steveklabnik @thestinger
2014-12-20Stabilize cloneAaron Turon-12/+26
This patch marks `clone` stable, as well as the `Clone` trait, but leaves `clone_from` unstable. The latter will be decided by the beta. The patch also marks most manual implementations of `Clone` as stable, except where the APIs are otherwise deprecated or where there is uncertainty about providing `Clone`.
2014-12-19Stabilize cellAaron Turon-19/+13
This patch finalizes stabilization for the `cell` module, settling on the current names `Cell`, `RefCell`, `UnsafeCell`, `Ref` and `RefMut`. While we had considered improving these names, no one was able to produce a truly compelling alternative. There is one substantive change here: the `get` method of `UnsafeSell` is now marked `unsafe`. Merely getting a raw pointer to the contents is not, by itself, an unsafe operation. (Consider that you can always safely turn a reference into a raw pointer, and that raw pointer may then be aliased by subsequent references.)
2014-12-19Stabilize integer modulesAaron Turon-10/+6
This small patch stabilizes the names of all integer modules (including `int` and `uint`) and the `MIN` and `MAX` constants. The `BITS` and `BYTES` constants are left unstable for now.
2014-12-20Fix fallout of removing import_shadowing in tests.Eduard Burtescu-6/+1
2014-12-20auto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankrobors-16/+11
The `is_power_of_two()` method of the `UnsignedInt` trait currently returns `true` for `self == 0`. Zero is not a power of two, assuming an integral exponent `k >= 0`. I've therefore moved this functionality to the new method `is_power_of_two_or_zero()` and reformed `is_power_of_two()` to return false for `self == 0`. To illustrate the usefulness of the existence of both functions, consider `HashMap`. Its capacity must be zero or a power of two; conversely, it also requires a (non-zero) power of two for key and val alignment. Also, added a small amount of documentation regarding #18604.
2014-12-19Reform power_of_two methods for perf increase & semantic change to consider ↵Aaron Liblong-16/+11
0 not a power of 2. Vec panics when attempting to reserve capacity > int::MAX (uint::MAX / 2).
2014-12-19std: Second pass stabilization of Result<T, E>Alex Crichton-54/+90
This commit, like the second pass of `Option`, largely just stablizes the existing functionality after renaming a few iterators. The specific actions taken were: * The `Ok` and `Err` variants were marked `#[stable]` as the stability inheritance was since removed. * The `as_mut` method is now stable. * The `map` method is now stable * The `map_err` method is now stable * The `iter`, `iter_mut`, and `into_iter` methods now returned structures named after the method of iteration. The methods are also now all stable. * The `and_then` method is now stable. * The `or_else` method is now stable. * The `unwrap` family of functions are now all stable: `unwrap_or`, `unwrap_or_else`, `unwrap`, and `unwrap_err`. There is a possible open extension to `Result::{and, and_then}` to make the return type further generic over `FromError` (as proposed in #19078), but this is a backwards compatible change due to the usage of default type parameters, which makes the two functions safe to stabilize now regardless of the outcome of that issue.
2014-12-19Register new snapshotsAlex Crichton-437/+0
This does not yet start the movement to rustc-serialize. That detail is left to a future PR.
2014-12-19libcore: use `#[deriving(Copy)]`Jorge Aparicio-151/+57
2014-12-19libcollections: use `#[deriving(Copy)]`Jorge Aparicio-2/+1
2014-12-19Allow marker types to have unsized parametersKevin Ballard-10/+20
Tweak CovariantType, ContravariantType, and InvariantType to allow their type parameter to be unsized.
2014-12-19Modify the `Bytes` type so that it remains cloneable evenNiko Matsakis-3/+20
though it includes a `fn()`. This is really a more general problem but I wanted to ensures that `bytes` in particular remains working due to #12677.
2014-12-18clean up ptr docsAlexis Beingessner-40/+94
2014-12-18std: Remove public bool,tuple,unit modulesAlex Crichton-70/+1
This commit modifies rustdoc to not require these empty modules to be public in the standard library. The modules still remain as a location to attach documentation to, but the modules themselves are now private (don't have to commit to an API). The documentation for the standard library now shows all of the primitive types on the main index page.
2014-12-18libcore: convert unop traits to by valueJorge Aparicio-0/+100
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-424/+433
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]
2014-12-17Use #[deriving(Copy)] for InvariantLifetimeJake Goulding-3/+1
2014-12-17rollup merge of #19942: steveklabnik/doc_std_memAlex Crichton-46/+139
2014-12-17rollup merge of #19902: alexcrichton/second-pass-memAlex Crichton-6/+27
This commit stabilizes the `mem` and `default` modules of std.
2014-12-17rollup merge of #19885: alexcrichton/char-escapeAlex Crichton-75/+68
This changes the `escape_unicode` method on a `char` to use the new style of unicode escapes in the language. Closes #19811 Closes #19879
2014-12-17rollup merge of #19873: drewm1980/masterAlex Crichton-26/+26
In US english, "that" is used in restrictive clauses in place of "which", and often affects the meaning of sentences. In UK english and many dialects, no distinction is made. While Rust devs want to avoid unproductive pedanticism, it is worth at least being uniform in documentation such as: http://doc.rust-lang.org/std/iter/index.html and also in cases where correct usage of US english clarifies the sentence.
2014-12-17rollup merge of #19860: japaric/copy-markersAlex Crichton-4/+2
Necessary to implement `Copy` on structs like this one: ``` rust struct Slice<'a, T> { _contravariant: marker::ContravariantLifetime<'a>, _nosend: marker::NoSend, data: *const T, length: uint, } ``` r? @alexcrichton
2014-12-17rollup merge of #19849: alexcrichton/second-pass-optionAlex Crichton-26/+87
This commit takes a second pass through the `std::option` module to fully stabilize any lingering methods inside of it. These items were made stable as-is * Some * None * as_mut * expect * unwrap * unwrap_or * unwrap_or_else * map * map_or * map_or_else * and_then * or_else * unwrap_or_default * Default implementation * FromIterator implementation * Copy implementation These items were made stable with modifications * iter - now returns a struct called Iter * iter_mut - now returns a struct called IterMut * into_iter - now returns a struct called IntoIter, Clone is never implemented This is a breaking change due to the modifications to the names of the iterator types returned. Code referencing the old names should updated to referencing the newer names instead. This is also a breaking change due to the fact that `IntoIter` no longer implements the `Clone` trait. These items were explicitly not stabilized * as_slice - waiting on indexing conventions * as_mut_slice - waiting on conventions with as_slice as well * cloned - the API was still just recently added * ok_or - API remains experimental * ok_or_else - API remains experimental [breaking-change]
2014-12-17rollup merge of #19838: shepmaster/invariant-lifetime-copyAlex Crichton-0/+2
Both ContravariantLifetime and CovariantLifetime are marked as Copy, so it makes sense for InvariantLifetime to be as well.
2014-12-17rollup merge of #19832: japaric/no-nocopyAlex Crichton-19/+9
r? @aturon / @alexcrichton
2014-12-17rollup merge of #19830: mchaput/patch-1Alex Crichton-1/+1
Error message has wrong spelling ("radix is to high").
2014-12-17rollup merge of #19827: japaric/clone-ucAlex Crichton-0/+135
closes #12677 (cc @Valloric) cc #15294 r? @aturon / @alexcrichton (Because of #19358 I had to move the struct bounds from the `where` clause into the parameter list)
2014-12-17auto merge of #19800 : sfackler/rust/core-hash, r=alexcrichtonbors-2/+791
r? @alexcrichton
2014-12-16Document std::memSteve Klabnik-46/+139