about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-08-22replace `BitAnd` example with something more evocative of bitwise ANDMatthew Piziak-12/+27
reformat method chain according to ubsan Rustic Style Guide https://ubsan.github.io/style/
2016-08-22replace `Mul` example with something more evocative of multiplicationMatthew Piziak-10/+47
I may have gone a bit overboard on this one. Numbers are fun. tone down the error message
2016-08-21Auto merge of #35777 - nrc:carrier3, r=@nikomatsakisbors-0/+72
Carrier trait (third attempt) This adds a `Carrier` trait to operate with `?`. The only public implementation is for `Result`, so effectively the trait does not exist, however, it ensures future compatibility for the `?` operator. This is not intended to be used, nor is it intended to be a long-term solution. Although this exact PR has not been through Crater, I do not expect it to be a breaking change based on putting numerous similar PRs though Crater in the past. cc: * [? tracking issue](https://github.com/rust-lang/rust/issues/31436) * [previous PR](https://github.com/rust-lang/rust/pull/35056) * [RFC issue](https://github.com/rust-lang/rfcs/issues/1718) for discussion of long-term Carrier trait solutions. r? @nikomatsakis
2016-08-21replace `println!` statements with `assert!`ions in `std::ptr` examplesMatthew Piziak-4/+8
r? @steveklabnik
2016-08-21Added #![feature] declarationsphilipp-0/+2
2016-08-20replace `Index` example with something more evocative of indexingMatthew Piziak-13/+29
r? @steveklabnik
2016-08-20replace `Rem` example with something more evocativeMatthew Piziak-11/+19
r? @steveklabnik
2016-08-20show how iterating over `RangeTo` and `RangeToInclusive` failsMatthew Piziak-12/+43
Feedback on PR #35701 seems to be positive, so this does the same thing for `RangeTo` and `RangeToInclusive`.
2016-08-20Introduce max_by/min_by on iteratorsphilipp-0/+51
2016-08-20Rollup merge of #35830 - matthew-piziak:not-example, r=steveklabnikJonathan Turner-11/+22
replace `Neg` example with something more evocative of negation
2016-08-20Rollup merge of #35827 - matthew-piziak:neg-example, r=steveklabnikJonathan Turner-11/+16
replace `Not` example with something more evocative
2016-08-20Rollup merge of #35806 - matthew-piziak:addassign-example, r=steveklabnikJonathan Turner-10/+21
replace `AddAssign` example with something more evocative of addition This is analogous to PR #35709 for the `Add` trait.
2016-08-20Rollup merge of #35800 - matthew-piziak:mul-div-examples, r=steveklabnikJonathan Turner-0/+62
demonstrate `RHS != Self` use cases for `Mul` and `Div` Vector-scalar multipication is a good usecase for this. Thanks #rust!
2016-08-20Rollup merge of #35710 - matthew-piziak:explicit-drop, r=steveklabnikJonathan Turner-0/+7
note that calling drop() explicitly is a compiler error Part of #29365
2016-08-20Rollup merge of #35709 - matthew-piziak:add-trait-example, r=GuillaumeGomezJonathan Turner-11/+23
replace `Add` example with something more evocative of addition Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of #29365
2016-08-20Rollup merge of #35701 - matthew-piziak:rangefull-example-error, r=steveklabnikJonathan Turner-7/+20
explicitly show how iterating over `..` fails I've also removed the `main()` wrapper, which I believe is extraneous. LMK if that's incorrect.
2016-08-20Auto merge of #35607 - alexcrichton:stabilize-1.12, r=brsonbors-10/+48
std: Stabilize APIs for the 1.12 release Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
2016-08-19Remove old stage0 compatibilityBrian Anderson-51/+29
2016-08-19std: Stabilize APIs for the 1.12 releaseAlex Crichton-10/+48
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
2016-08-19replace `Neg` example with something more evocative of negationMatthew Piziak-11/+22
2016-08-19replace `Not` example with something more evocativeMatthew Piziak-11/+16
2016-08-18Auto merge of #35719 - Amanieu:atomic_access, r=alexcrichtonbors-0/+142
Implement RFC 1649 cc #35603 rust-lang/rfcs#1649 r? @alexcrichton
2016-08-19Remove the Option and bool impls for carrier and add a dummy implNick Cameron-60/+7
The dummy impl should ensure the same type checking behaviour as having other (real) Carrier impls.
2016-08-18replace `AddAssign` example with something more evocative of additionMatthew Piziak-10/+21
This is analogous to PR #35709 for the `Add` trait.
2016-08-18note that calling drop() explicitly is a compiler errorMatthew Piziak-0/+7
Part of #29365 explain that std::mem::drop in prelude will invoke Drop change "prelude" -> "the prelude"; change links to reference-style move link references to links' section
2016-08-18split example into three sections with explanationMatthew Piziak-3/+14
2016-08-18demonstrate `RHS != Self` use cases for `Mul` and `Div`Matthew Piziak-0/+62
Vector-scalar multipication is a good usecase for this. Thanks #rust!
2016-08-18Add a FusedIterator trait.Steven Allen-11/+262
This trait can be used to avoid the overhead of a fuse wrapper when an iterator is already well-behaved. Conforming to: RFC 1581 Closes: #35602
2016-08-18Use a Carrier trait with the `?` operatorNick Cameron-0/+125
Allows use with `Option` and custom `Result`-like types.
2016-08-17replace Add example with something more evocative of additionMatthew Piziak-11/+23
Currently most of the operator traits use trivial implementation examples that only perform side effects. Honestly, that might not be too bad for the sake of documentation; but anyway, here's a proposal to move a slightly modified version of the module-level point-addition example into the `Add` documentation, since it's more evocative of addition semantics. Part of #29365 wrap identifiers in backticks minor rephrasing fix module-level documentation to be more truthful This branch changes the example for `Add` to no longer be a "minimum implementation that prints something to the screen".
2016-08-17Rollup merge of #35695 - matthew-piziak:vec-assert-over-println, ↵Jonathan Turner-15/+2
r=GuillaumeGomez accumulate into vector and assert, instead of printing I'm only making this change in one place so that people can express their preferences for this stylistic change. If/when this change is approved I'll go ahead and translate the rest of the `std::ops` examples.
2016-08-17Rollup merge of #35690 - matthew-piziak:op-overloading-limited, r=steveklabnikJonathan Turner-3/+8
expound on limitations of Rust's trait-based operator overloading Part of #29330
2016-08-17Rollup merge of #35663 - CryZe:no-stdlib, r=ManishearthJonathan Turner-0/+5
Improve `No stdlib` and related Documentation This renames all lang item function names to the ones used in `libstd` and `libpanic_unwind`. It also explains the `eh_unwind_resume` lang item in the `libcore` documentation, where it was missing. A third function is also needed on certain compilation targets, so this was also added to the `No stdlib` documentation.
2016-08-16Implement RFC 1649Amanieu d'Antras-0/+142
2016-08-16Implement `AsRef<[T]>` for `std::slice::Iter`.Corey Farwell-0/+8
`AsRef` is designed for conversions that are "cheap" (as per the API docs). It is the case that retrieving the underlying data of `std::slice::Iter` is cheap. In my opinion, there's no ambiguity about what slice data will be returned, otherwise, I would be more cautious about implementing `AsRef`.
2016-08-16RangeFull for-loop iteration fails because of IntoIteratorMatthew Piziak-1/+1
Saying that "[for-loop iteration] fails because .. has no IntoIterator impl" is more direct than saying "...no Iterator impl" because for loops sugar into IntoIterator invocations. It just happens that the other Range* operators implement Iterator and rely on the fact that `IntoIterator` is implemented for `T: Iterator`.
2016-08-16Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakisbors-0/+59
Implement the `!` type This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-15explicitly show how iterating over `..` failsMatthew Piziak-8/+10
I've also removed the `main()` wrapper, which I believe is extraneous. LMK if that's incorrect.
2016-08-15remove `.take(10)` from `Range` exampleMatthew Piziak-1/+1
2016-08-15accumulate into vector and assert, instead of printingMatthew Piziak-15/+2
I'm only making this change in one place so that people can express their preferences for this stylistic change. If/when this change is approved I'll go ahead and translate the rest of the `std::ops` examples.
2016-08-15expound on limitations of Rust's trait-based operator overloadingMatthew Piziak-3/+8
Part of #29330
2016-08-14Implement `CoerceUnsized` for `{Cell, RefCell, UnsafeCell}`Andrew Paseltiner-0/+16
2016-08-14Rollup merge of #35622 - matthew-piziak:convert-docs-typos, r=apasel422Eduard-Mihai Burtescu-4/+4
fix small typos in std::convert documentation Fix subject-verb agreement in copypasta: "`AsRef` dereference" to "`AsRef` dereferences". Formalize "eg" to "e.g." Italicization of common Latin abbreviations seems to be going out of style in written English, so I left it plain.
2016-08-14Rollup merge of #35588 - Antti:fix-atomics-docs, r=alexcrichtonEduard-Mihai Burtescu-1/+1
Use an existing constant name as an example. By reading atomics documentation I tried to use `INIT_ATOMIC_BOOL`, which I couldn't find. Turns out it was renamed to `ATOMIC_BOOL_INIT`.
2016-08-14Rollup merge of #35392 - malbarbo:cell-from, r=brsonEduard-Mihai Burtescu-0/+22
Implement From for Cell, RefCell and UnsafeCell Considering that `From` is implemented for `Box`, `Rc` and `Arc`, it seems [reasonable](https://internals.rust-lang.org/t/implementing-from-t-for-other-std-types/3744) to implement it for `Cell`, `RefCell` and `UnsafeCell`.
2016-08-14Improve `No stdlib` and related DocumentationChristopher Serr-0/+5
2016-08-13Rename empty/bang to neverAndrew Cann-7/+7
Split Ty::is_empty method into is_never and is_uninhabited
2016-08-13Minor fixups based on @eddyb's feedbackAndrew Cann-4/+6
Mainly, remove mk_empty() method and replace with tcx.types.empty
2016-08-13Control usage of `!` through a feature gate.Andrew Cann-0/+1
Adds the `bang_type` feature gate. `!` in a non-return-type position now relies on that feature.
2016-08-13implement std::cmp::* traits for `!`Andrew Cann-0/+33