about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-01-14Remove erroneous stability attribute.Brian Anderson-3/+0
This outer attribute doesn't actually apply to anything is seems to be incorrect in what it is saying.
2015-01-14Small Readability UpdateTristan Storch-12/+9
2015-01-14auto merge of #21082 : brson/rust/finally, r=alexcrichtonbors-1/+5
No in-tree users. Ugly interface. Closes #14332. I just happened to notice that this module still lives and has no users. Assuming we don't want it. r? @aturon cc @alexcrichton
2015-01-14auto merge of #21061 : japaric/rust/range, r=nick29581bors-12/+12
2015-01-13Address feedbackBrian Anderson-1/+5
2015-01-13Remove unneeded box import in examplesChase Southwood-2/+0
2015-01-13Use if-let in std::result documentationSimonas Kazlauskas-6/+4
This takes an opportunity to show yet-another-way of dealing with Results and matching.
2015-01-13Fix a typo in std::result documentationSimonas Kazlauskas-1/+1
2015-01-13std: Deprecate `finally` moduleBrian Anderson-1/+1
No in-tree users. Ugly interface. Closes #14332.
2015-01-12cleanup: `&foo[0..a]` -> `&foo[..a]`Jorge Aparicio-12/+12
2015-01-12auto merge of #20896 : sfackler/rust/atomic-rename, r=alexcrichtonbors-127/+258
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-12auto merge of #20942 : nagisa/rust/shrl-impls, r=nikomatsakisbors-8/+60
This is only relevant to the code that uses generics such as fn magic<T: Shl>(a: T) { a << 10u8; } r? @nikomatsakis
2015-01-12auto merge of #20889 : Manishearth/rust/trait-error, r=nikomatsakisbors-0/+3
fixes #20783 r? @nikomatsakis
2015-01-11Rename AtomicInt and AtomicUintSteven Fackler-127/+258
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
2015-01-12Feature gate #[rustc_on_unimplemented]Manish Goregaokar-0/+1
2015-01-11Rename #[on_unimplemented] -> #[rustc_on_unimplemented]Manish Goregaokar-2/+2
2015-01-11Allow any integral to be used as Shr and Shl RHSSimonas Kazlauskas-8/+60
This is only relevant to the code that uses generics such as fn magic<T: Shl>(a: T) { a << 10u8; } Fixes #20288
2015-01-11Add ability to attach custom #[on_unimplemented] error messages for ↵Manish Goregaokar-0/+2
unimplemented traits (fixes #20783)
2015-01-10auto merge of #20839 : alexcrichton/rust/missing-stability, r=aturonbors-0/+2
Both `Extend::extend` and `DoubleEndedIterator::next_back` were intended to be stable, but they mistakenly didn't have the `#[stable]` tag.
2015-01-10auto merge of #20837 : huonw/rust/remove-unused-lifetime, r=nikomatsakisbors-0/+32
2015-01-10auto merge of #20794 : sfackler/rust/trailing-attrs, r=alexcrichtonbors-3/+6
Closes #20711
2015-01-10core: rm unused lifetime.Huon Wilson-0/+32
2015-01-09std: Mark two missing functions as #[stable]Alex Crichton-0/+2
Both `Extend::extend` and `DoubleEndedIterator::next_back` were intended to be stable, but they mistakenly didn't have the `#[stable]` tag.
2015-01-09Re-reduce libstd macro duplicationKeegan McAllister-2/+7
The libstd definitions move to libcore, which causes some minor updates there.
2015-01-08Forbid trailing attributes in impl blocksSteven Fackler-3/+6
Closes #20711
2015-01-08rollup merge of #20754: nikomatsakis/int-featureAlex Crichton-3/+4
Conflicts: src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs src/test/compile-fail/issue-2590.rs src/test/compile-fail/lint-stability.rs src/test/compile-fail/slice-mut-2.rs src/test/compile-fail/std-uncopyable-atomics.rs
2015-01-08Remove warning from the libraries.Huon Wilson-3/+4
This adds the int_uint feature to *every* library, whether or not it needs it.
2015-01-08Improvements to feature stagingBrian Anderson-110/+110
This gets rid of the 'experimental' level, removes the non-staged_api case (i.e. stability levels for out-of-tree crates), and lets the staged_api attributes use 'unstable' and 'deprecated' lints. This makes the transition period to the full feature staging design a bit nicer.
2015-01-08Add missing module stability attributesAaron Turon-0/+1
2015-01-07Test fixes and rebase conflictsAlex Crichton-7/+14
2015-01-07rollup merge of #20720: nick29581/assoc-ice-missingAlex Crichton-4/+33
2015-01-08Remove String impls and fix for make tidyNick Cameron-51/+0
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-47/+46
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustc/lint/builtin.rs src/librustc/session/config.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/context.rs src/librustc_trans/trans/type_.rs src/librustc_typeck/check/_match.rs src/librustdoc/html/format.rs src/libsyntax/std_inject.rs src/libsyntax/util/interner.rs src/test/compile-fail/mut-pattern-mismatched.rs
2015-01-07rollup merge of #20722: alexcrichton/audit-showAlex Crichton-39/+13
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustdoc/html/format.rs
2015-01-07rollup merge of #20708: aturon/new-int-modulesAlex Crichton-77/+56
Conflicts: src/libserialize/lib.rs
2015-01-07rollup merge of #20696: reem/unsized-typeidAlex Crichton-0/+13
This removes the needlessly constricting bound on `intrinsics::type_Id` and `TypeId::of`. Also fixes an ICE where using bounds on type parameters in extern blocks fails to resolve the used traits.
2015-01-07rollup merge of #20680: nick29581/target-wordAlex Crichton-8/+11
Closes #20421 [breaking-change] r? @brson
2015-01-07rollup merge of #20663: brson/feature-stagingAlex Crichton-0/+1
This partially implements the feature staging described in the [release channel RFC][rc]. It does not yet fully conform to the RFC as written, but does accomplish its goals sufficiently for the 1.0 alpha release. It has three primary user-visible effects: * On the nightly channel, use of unstable APIs generates a warning. * On the beta channel, use of unstable APIs generates a warning. * On the beta channel, use of feature gates generates a warning. Code that does not trigger these warnings is considered 'stable', modulo pre-1.0 bugs. Disabling the warnings for unstable APIs continues to be done in the existing (i.e. old) style, via `#[allow(...)]`, not that specified in the RFC. I deem this marginally acceptable since any code that must do this is not using the stable dialect of Rust. Use of feature gates is itself gated with the new 'unstable_features' lint, on nightly set to 'allow', and on beta 'warn'. The attribute scheme used here corresponds to an older version of the RFC, with the `#[staged_api]` crate attribute toggling the staging behavior of the stability attributes, but the user impact is only in-tree so I'm not concerned about having to make design changes later (and I may ultimately prefer the scheme here after all, with the `#[staged_api]` crate attribute). Since the Rust codebase itself makes use of unstable features the compiler and build system do a midly elaborate dance to allow it to bootstrap while disobeying these lints (which would otherwise be errors because Rust builds with `-D warnings`). This patch includes one significant hack that causes a regression. Because the `format_args!` macro emits calls to unstable APIs it would trigger the lint. I added a hack to the lint to make it not trigger, but this in turn causes arguments to `println!` not to be checked for feature gates. I don't presently understand macro expansion well enough to fix. This is bug #20661. Closes #16678 [rc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md Next steps are to disable the existing out-of-tree behavior for stability attributes, and convert the remaining system to be feature-based per the RFC. During the first beta cycle we will set these lints to 'forbid'.
2015-01-07rollup merge of #20654: alexcrichton/stabilize-hashAlex Crichton-533/+400
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-07fix the `&mut _` patternsJorge Aparicio-5/+5
2015-01-08Remove the unneeded Sized bound on TypeId creationJonathan Reem-0/+13
This bound is probably unintentional and is unnecessarily constricting. To facilitate this change, it was also necessary to modify resolve to recurse on and resolve type parameters in extern { } blocks. This fixes an ICE when using bounds on type parameters during the declaration of intrinsics. This also adds tests for TypeId on both Sized and Unsized tests as well as a test for using type parameters and bounds in extern { } blocks.
2015-01-07Preliminary feature stagingBrian Anderson-0/+1
This partially implements the feature staging described in the [release channel RFC][rc]. It does not yet fully conform to the RFC as written, but does accomplish its goals sufficiently for the 1.0 alpha release. It has three primary user-visible effects: * On the nightly channel, use of unstable APIs generates a warning. * On the beta channel, use of unstable APIs generates a warning. * On the beta channel, use of feature gates generates a warning. Code that does not trigger these warnings is considered 'stable', modulo pre-1.0 bugs. Disabling the warnings for unstable APIs continues to be done in the existing (i.e. old) style, via `#[allow(...)]`, not that specified in the RFC. I deem this marginally acceptable since any code that must do this is not using the stable dialect of Rust. Use of feature gates is itself gated with the new 'unstable_features' lint, on nightly set to 'allow', and on beta 'warn'. The attribute scheme used here corresponds to an older version of the RFC, with the `#[staged_api]` crate attribute toggling the staging behavior of the stability attributes, but the user impact is only in-tree so I'm not concerned about having to make design changes later (and I may ultimately prefer the scheme here after all, with the `#[staged_api]` crate attribute). Since the Rust codebase itself makes use of unstable features the compiler and build system to a midly elaborate dance to allow it to bootstrap while disobeying these lints (which would otherwise be errors because Rust builds with `-D warnings`). This patch includes one significant hack that causes a regression. Because the `format_args!` macro emits calls to unstable APIs it would trigger the lint. I added a hack to the lint to make it not trigger, but this in turn causes arguments to `println!` not to be checked for feature gates. I don't presently understand macro expansion well enough to fix. This is bug #20661. Closes #16678 [rc]: https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md
2015-01-07std: Tweak String implementationsAlex Crichton-61/+13
This commit performs a pass over the implementations of the new `String` trait in the formatting module. Some implementations were removed as a conservative move pending an upcoming convention about `String` implementations, and some were added in order to retain consistency across the libraries. Specifically: * All "smart pointers" implement `String` now, adding missing implementations for `Arc` and `Rc`. * The `Vec<T>` and `[T]` types no longer implement `String`. * The `*const T` and `*mut T` type no longer implement `String`. * The `()` type no longer implements `String`. * The `Path` type's `Show` implementation does not surround itself with `Path {}` (a minor tweak). All implementations of `String` in this PR were also marked `#[stable]` to indicate that the types will continue to implement the `String` trait regardless of what it looks like.
2015-01-07use slicing sugarJorge Aparicio-42/+41
2015-01-08Show, String, Eq impls for RangesNick Cameron-4/+84
2015-01-07register new snapshotsJorge Aparicio-58/+0
2015-01-07std: Stabilize the std::hash moduleAlex Crichton-533/+400
This commit aims to prepare the `std::hash` module for alpha by formalizing its current interface whileholding off on adding `#[stable]` to the new APIs. The current usage with the `HashMap` and `HashSet` types is also reconciled by separating out composable parts of the design. The primary goal of this slight redesign is to separate the concepts of a hasher's state from a hashing algorithm itself. The primary change of this commit is to separate the `Hasher` trait into a `Hasher` and a `HashState` trait. Conceptually the old `Hasher` trait was actually just a factory for various states, but hashing had very little control over how these states were used. Additionally the old `Hasher` trait was actually fairly unrelated to hashing. This commit redesigns the existing `Hasher` trait to match what the notion of a `Hasher` normally implies with the following definition: trait Hasher { type Output; fn reset(&mut self); fn finish(&self) -> Output; } This `Hasher` trait emphasizes that hashing algorithms may produce outputs other than a `u64`, so the output type is made generic. Other than that, however, very little is assumed about a particular hasher. It is left up to implementors to provide specific methods or trait implementations to feed data into a hasher. The corresponding `Hash` trait becomes: trait Hash<H: Hasher> { fn hash(&self, &mut H); } The old default of `SipState` was removed from this trait as it's not something that we're willing to stabilize until the end of time, but the type parameter is always required to implement `Hasher`. Note that the type parameter `H` remains on the trait to enable multidispatch for specialization of hashing for particular hashers. Note that `Writer` is not mentioned in either of `Hash` or `Hasher`, it is simply used as part `derive` and the implementations for all primitive types. With these definitions, the old `Hasher` trait is realized as a new `HashState` trait in the `collections::hash_state` module as an unstable addition for now. The current definition looks like: trait HashState { type Hasher: Hasher; fn hasher(&self) -> Hasher; } The purpose of this trait is to emphasize that the one piece of functionality for implementors is that new instances of `Hasher` can be created. This conceptually represents the two keys from which more instances of a `SipHasher` can be created, and a `HashState` is what's stored in a `HashMap`, not a `Hasher`. Implementors of custom hash algorithms should implement the `Hasher` trait, and only hash algorithms intended for use in hash maps need to implement or worry about the `HashState` trait. The entire module and `HashState` infrastructure remains `#[unstable]` due to it being recently redesigned, but some other stability decision made for the `std::hash` module are: * The `Writer` trait remains `#[experimental]` as it's intended to be replaced with an `io::Writer` (more details soon). * The top-level `hash` function is `#[unstable]` as it is intended to be generic over the hashing algorithm instead of hardwired to `SipHasher` * The inner `sip` module is now private as its one export, `SipHasher` is reexported in the `hash` module. And finally, a few changes were made to the default parameters on `HashMap`. * The `RandomSipHasher` default type parameter was renamed to `RandomState`. This renaming emphasizes that it is not a hasher, but rather just state to generate hashers. It also moves away from the name "sip" as it may not always be implemented as `SipHasher`. This type lives in the `std::collections::hash_map` module as `#[unstable]` * The associated `Hasher` type of `RandomState` is creatively called... `Hasher`! This concrete structure lives next to `RandomState` as an implemenation of the "default hashing algorithm" used for a `HashMap`. Under the hood this is currently implemented as `SipHasher`, but it draws an explicit interface for now and allows us to modify the implementation over time if necessary. There are many breaking changes outlined above, and as a result this commit is a: [breaking-change]
2015-01-08Rename `target_word_size` to `target_pointer_width`Nick Cameron-8/+11
Closes #20421 [breaking-change]
2015-01-07Add isize, usize modules, deprecate int, uint modulesAaron Turon-6/+55
This PR introduces `isize` and `usize` modules to `core` and `std`, and deprecates the existing `int` and `uint` modules. The rustdoc primitive type links now point to these new modules. Due to deprecation this is a: [breaking-change]
2015-01-07Register new snapshotsAlex Crichton-71/+1