about summary refs log tree commit diff
path: root/src/libcore/option.rs
AgeCommit message (Collapse)AuthorLines
2015-01-13Remove unneeded box import in examplesChase Southwood-1/+0
2015-01-08Improvements to feature stagingBrian Anderson-2/+2
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-07Test fixes and rebase conflictsAlex Crichton-2/+2
2015-01-07rollup merge of #20721: japaric/snapAlex Crichton-1/+1
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-07fix the `&mut _` patternsJorge Aparicio-1/+1
2015-01-07std: Tweak String implementationsAlex Crichton-6/+6
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-06More test fixesAlex Crichton-1/+1
2015-01-05Revert "Remove i suffix in docs"Alex Crichton-6/+6
This reverts commit f031671c6ea79391eeb3e1ad8f06fe0e436103fb. Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05rollup merge of #20560: aturon/stab-2-iter-ops-sliceAlex Crichton-0/+9
Conflicts: src/libcollections/slice.rs src/libcore/iter.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/rwlock.rs
2015-01-05Remove i suffix in docsSteve Klabnik-6/+6
2015-01-05Stabilization of impls and fallout from stabilizationAaron Turon-0/+9
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-2/+2
2015-01-03core: use assoc types in Iterator et alJorge Aparicio-14/+24
2015-01-02core: use assoc types in `Deref[Mut]`Jorge Aparicio-1/+1
2014-12-21Fallout of std::str stabilizationAlex Crichton-3/+3
2014-12-20Stabilize cloneAaron Turon-0/+1
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-19libcore: use `#[deriving(Copy)]`Jorge Aparicio-6/+1
2014-12-17rollup merge of #19902: alexcrichton/second-pass-memAlex Crichton-0/+1
This commit stabilizes the `mem` and `default` modules of std.
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-15Move hash module from collections to coreSteven Fackler-1/+1
2014-12-15std: Second pass stabilization of `default`Alex Crichton-0/+1
This commit performs a second pass stabilization of the `std::default` module. The module was already marked `#[stable]`, and the inheritance of `#[stable]` was removed since this attribute was applied. This commit adds the `#[stable]` attribute to the trait definition and one method name, along with all implementations found in the standard distribution.
2014-12-14std: Fully stabilize Option<T>Alex 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-13libcore: use unboxed closures in `Option` methodsJorge Aparicio-8/+8
2014-12-11Register new snapshotsAlex Crichton-3/+0
2014-12-09Test fixes and rebase conflicts from the rollupAlex Crichton-0/+3
2014-12-09rollup merge of #19653: frewsxcv/rm-reexportsAlex Crichton-1/+1
Brief note: This does *not* affect anything in the prelude Part of #19253 All this does is remove the reexporting of Result and Option from their respective modules. More core reexports might be removed, but these ones are the safest to remove since these enums (and their variants) are included in the prelude. Depends on https://github.com/rust-lang/rust/pull/19407 which is merged, but might need a new snapshot [breaking-change]
2014-12-08Remove Result and Option reexportsCorey Farwell-1/+1
Brief note: This does *not* affect anything in the prelude Part of #19253 All this does is remove the reexporting of Result and Option from their respective modules. More core reexports might be removed, but these ones are the safest to remove since these enums (and their variants) are included in the prelude. [breaking-change]
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-1/+6
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-05Utilize fewer reexportsCorey Farwell-1/+2
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-03Fix falloutJorge Aparicio-3/+3
2014-11-25Fallout from stabilizationAaron Turon-2/+2
2014-11-20Rename remaining Failures to PanicSubhash Bhushan-2/+2
2014-11-18make cloned generic over deref... and have its tests actually runAlexis Beingessner-3/+5
2014-11-17Switch to purely namespaced enumsSteven Fackler-8/+10
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-2/+2
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-2/+2
2014-11-17auto merge of #18914 : Gankro/rust/cloned, r=aturonbors-0/+9
Part of #18424. r? @aturon [breaking-change]
2014-11-17auto merge of #18927 : areski/rust/pr-improve-option-match-readl, r=jakub-bors-5/+20
**match** are much more easy to read when it's not in 1 single line
2014-11-16implement cloned for OptionAlexis Beingessner-0/+9
2014-11-14libs: fix #[stable] inheritance falloutAaron Turon-2/+3
A recent change turned off inheritance for the #[stable] by default, but failed to catch all the cases where this was being used in std. This patch fixes that problem.
2014-11-13convert 1 line match to 2 lines for readabilityareski-5/+20
2014-11-05Fix fallout of changing the expansion of `#[deriving(PartialEq)]`Jorge Aparicio-1/+1
2014-11-05Repair various cases where values of distinct types were being operatedNiko Matsakis-2/+2
upon (e.g., `&int` added to `int`).
2014-10-29Rename fail! to panic!Steve Klabnik-7/+7
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-21auto merge of #18201 : Gankro/rust/option-what, r=alexcrichtonbors-1/+1
:whale:
2014-10-20Fix crazy-pants match in Option docsAlexis Beingessner-1/+1
2014-10-19Remove a large amount of deprecated functionalityAlex Crichton-140/+0
Spring cleaning is here! In the Fall! This commit removes quite a large amount of deprecated functionality from the standard libraries. I tried to ensure that only old deprecated functionality was removed. This is removing lots and lots of deprecated features, so this is a breaking change. Please consult the deprecation messages of the deleted code to see how to migrate code forward if it still needs migration. [breaking-change]
2014-10-07Reinstate AsSlice impls for Option and ResultNick Cameron-0/+16
2014-10-07Rename slice::SliceNick Cameron-16/+0
2014-09-28Defailbloat fail!(&'static str)Tobba-1/+1