about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-09-02core: add likely and unlikely intrinsicsSean McArthur-0/+14
2016-09-01Document try!'s error conversion behaviourFlorian Gilcher-7/+26
2016-09-01Auto merge of #35755 - SimonSapin:char_convert, r=alexcrichtonbors-6/+63
Implement std::convert traits for char This is motivated by avoiding the `as` operator, which sometimes silently truncates, and instead use conversions that are explicitly lossless and infallible. I’m less certain that `From<u8> for char` should be implemented: while it matches an existing behavior of `as`, it’s not necessarily the right thing to use for non-ASCII bytes. It effectively decodes bytes as ISO/IEC 8859-1 (since Unicode designed its first 256 code points to be compatible with that encoding), but that is not apparent in the API name.
2016-08-31replace `../` with `../../std/` to support `core` docsMatthew Piziak-2/+2
2016-08-31Rollup merge of #36083 - GuillaumeGomez:missing_convert_urls, r=steveklabnikJonathan Turner-16/+39
Add missing urls into convert module r? @steveklabnik
2016-08-31Rollup merge of #35927 - matthew-piziak:bitandassign-example, r=GuillaumeGomezJonathan Turner-9/+51
replace `BitAndAssign` example with something more evocative This is the augmented-assignment version of PR #35809. r? @GuillaumeGomez
2016-08-31Add missing urls into convert moduleGuillaume Gomez-16/+39
2016-08-31Rollup merge of #36165 - fanzier:fix-typo, r=GuillaumeGomezJonathan Turner-1/+1
Fix typo in PartialOrd docs The inline code was formatted incorrectly because of the backtick.
2016-08-31Rollup merge of #35926 - matthew-piziak:bit-or-xor-examples, r=GuillaumeGomezJonathan Turner-18/+81
add evocative examples for `BitOr` and `BitXor` These are exactly equivalent to PR #35809, with one caveat: I do not believe there is a non-bitwise binary XOR operator in Rust, so here it's expressed as `(a || b) && !(a && b)`. Alternative decompositions are `(a && !b) || (!a && b)` and `(a || b) && (!a || !b)`. Let me know if you think one of those would be clearer. r? @GuillaumeGomez
2016-08-31Rollup merge of #35758 - matthew-piziak:vec-assert-over-println-remaining, ↵Jonathan Turner-22/+10
r=GuillaumeGomez accumulate vector and assert for RangeFrom and RangeInclusive examples PR #35695 for `Range` was merged, so it seems that this side-effect-free style is preferred for Range* examples. This PR performs the same translation for `RangeFrom` and `RangeInclusive`. It also removes what looks to be an erroneously commented line for `#![feature(step_by)]`, and an unnecessary primitive-type annotation in `0u8..`.
2016-08-31Fix typo in PartialOrd docsFabian Zaiser-1/+1
2016-08-30replace `BitAndAssign` example with something more evocativeMatthew Piziak-9/+51
This is the augmented-assignment version of PR #35809. r? @GuillaumeGomez improved documentation a la PR #35993
2016-08-30add evocative examples for `BitOr` and `BitXor`Matthew Piziak-18/+81
These are exactly equivalent to PR #35809, with one caveat: I do not believe there is a non-bitwise binary "xor" operator in Rust, so here it's expressed as (a || b) && !(a && b). r? @GuillaumeGomez improved documentation a la PR #35993
2016-08-30Rollup merge of #35993 - matthew-piziak:bitwise-and-redux, r=GuillaumeGomezGuillaume Gomez-21/+41
improve `BitAnd` trait documentation This pull request is based on the discussion in PR #35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground.
2016-08-30Rollup merge of #35895 - F001:patch-1, r=steveklabnikGuillaume Gomez-10/+39
Fix documentation in cell mod The implementation of Rc type in this doc is outdated.
2016-08-30Rollup merge of #35863 - matthew-piziak:shl-example, r=steveklabnikGuillaume Gomez-18/+76
add evocative examples for `Shl` and `Shr` r? @steveklabnik
2016-08-30Rollup merge of #35810 - matthew-piziak:fn-trait-example, r=steveklabnikGuillaume Gomez-0/+165
improve documentation for `Fn*` traits This PR is not yet a serious attempt at contribution. Rather, I'm opening this for discussion. I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits: - the relationship between these traits and the closures that implement them - examples of non-closure implementations - the relationship between these traits and Rust's ownership semantics
2016-08-30Rollup merge of #35771 - matthew-piziak:range-inclusive-example-error, ↵Guillaume Gomez-12/+43
r=steveklabnik show how iterating over `RangeTo` and `RangeToInclusive` fails Feedback on PR #35701 seems to be positive, so this does the same thing for `RangeTo` and `RangeToInclusive`.
2016-08-29Changed issue number to 36105philipp-2/+2
2016-08-29Implement TryFrom<u32> for charSimon Sapin-6/+29
For symmetry with From<char> for u32.
2016-08-29Implement From<char> for u32, and From<u8> for charSimon Sapin-0/+34
These fit with other From implementations between integer types. This helps the coding style of avoiding the 'as' operator that sometimes silently truncates, and signals that these specific conversions are lossless and infaillible.
2016-08-29demonstrate `RHS != Self` use cases for `Add` and `Sub`Matthew Piziak-0/+12
remove extra `../`s
2016-08-26improve `BitAnd` trait documentationMatthew Piziak-21/+41
This pull request is based on the discussion in PR #35927. Add a module-level note that `&&` and `||` are short-circuiting operators and not overloadable. Add a simple `Scalar` example that lifts the `&` operator to a trivial struct tuple. Make `BooleanVector` a struct tuple. Derive `PartialEq` for `BooleanVector` instead of implementing it. Adds a `fn main` wrapper so that the example can integrate with Rust Playground. simplified bitand expression add a comment explaining what "rhs" means
2016-08-26accumulate vector and assert for RangeFrom and RangeInclusive examplesMatthew Piziak-22/+10
PR #35695 for `Range` was approved, so it seems that this side-effect-free style is preferred for Range* examples. This PR performs the same translation for `RangeFrom` and `RangeInclusive`. It also removes what looks to be an erroneously commented line for `#![feature(step_by)]`, and an unnecessary primitive-type annotation in `0u8..`. add `fn main` wrappers to enable Rust Playground "Run" button
2016-08-26Replace unnecessary uses of `TraitObject` with castsAndrew Paseltiner-12/+2
2016-08-25Auto merge of #35906 - jseyfried:local_prelude, r=eddybbors-183/+30
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2016-08-26Fix documentation in cell modchangchun.fan-10/+39
2016-08-25Rollup merge of #35947 - SimonSapin:decodeutf8-error-handling, r=alexcrichtonManish Goregaokar-13/+69
Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossy r? @alexcrichton
2016-08-24Auto merge of #35971 - jonathandturner:rollup, r=jonathandturnerbors-19/+43
Rollup of 4 pull requests - Successful merges: #35876, #35920, #35948, #35961 - Failed merges: #35395
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-183/+30
2016-08-24Rollup merge of #35876 - matthew-piziak:sub-examples, r=GuillaumeGomezJonathan Turner-19/+43
more evocative examples for `Sub` and `SubAssign` These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of #29365. r? @steveklabnik
2016-08-24Remove drop flags from structs and enums implementing Drop.Eduard Burtescu-99/+0
2016-08-23add more-evocative examples for `Shl` and `Shr`Matthew Piziak-18/+76
r? @steveklabnik add examples that lift `<<` and `>>` to a trivial struct replace `Scalar` structs with struct tuples add `fn main` wrappers to enable Rust Playground "Run" button
2016-08-23Rollup merge of #35949 - tshepang:excess, r=GuillaumeGomezGuillaume Gomez-1/+0
doc: one line too many
2016-08-23Rollup merge of #35936 - matthew-piziak:div-rational-example, r=GuillaumeGomezGuillaume Gomez-9/+52
replace `Div` example with something more evocative of division Analogous to PR #35860. r? @GuillaumeGomez
2016-08-23Rollup merge of #35910 - tbu-:pr_weird_linebreak, r=alexcrichtonGuillaume Gomez-2/+3
Change a weird line break in `core::str`
2016-08-23doc: one line too manyTshepang Lekhonkhobe-1/+0
2016-08-23Yield Err in char::decode_utf8 per Unicode, like String::from_utf8_lossySimon Sapin-13/+69
2016-08-23replace `Div` example with something more evocative of divisionMatthew Piziak-9/+52
Analogous to PR #35860. r? @GuillaumeGomez
2016-08-23improve documentation for `Fn*` traitsMatthew Piziak-0/+165
I can think of a few things we may want to accomplish with the documentation of the `Fn`, `FnMut`, and `FnOnce` traits: - the relationship between these traits and the closures that implement them - examples of non-closure implementations - the relationship between these traits and Rust's ownership semantics add module-level documentation for `Fn*` traits Describe how `Fn*` traits, closure types, and ownership semantics are linked, and provide examples of higher-level functions that take `Fn*`s. more examples for `Fn*` traits create correct (though not yet elegant) examples for `FnMut` and `FnOnce` add trait links to module-level documentation third time's a charm! argument -> capture for trait documentation This wording will need to be supported with better examples for capturing eventually. correct `FnOnce` example I also fixed some of the trait wording here to make the concept of capturing clearer; though that still needs more work. replace `x + x` with `x * 2` for `fn double`
2016-08-23Auto merge of #35656 - Stebalien:fused, r=alexcrichtonbors-11/+262
Implement 1581 (FusedIterator) * [ ] Implement on patterns. See https://github.com/rust-lang/rust/issues/27721#issuecomment-239638642. * [ ] Handle OS Iterators. A bunch of iterators (`Args`, `Env`, etc.) in libstd wrap platform specific iterators. The current ones all appear to be well-behaved but can we assume that future ones will be? * [ ] Does someone want to audit this? On first glance, all of the iterators on which I implemented `FusedIterator` appear to be well-behaved but there are a *lot* of them so a second pair of eyes would be nice. * I haven't touched rustc internal iterators (or the internal rand) because rustc doesn't actually call `fuse()`. * `FusedIterator` can't be implemented on `std::io::{Bytes, Chars}`. Closes: #35602 (Tracking Issue) Implements: rust-lang/rfcs#1581
2016-08-23Auto merge of #35627 - apasel422:coerce-cell, r=alexcrichtonbors-0/+16
Implement `CoerceUnsized` for `{Cell, RefCell, UnsafeCell}` These impls are analogous to the one for `NonZero`. It's occasionally useful to be able to coerce the cell types when they're being used inside another abstraction. See Manishearth/rust-gc#17 for an example. r? @eddyb
2016-08-22Auto merge of #35766 - brson:bump, r=alexcrichtonbors-51/+29
Upgrade bootstrap compiler to 1.12 r? @alexcrichton
2016-08-23Change a weird line break in `core::str`Tobias Bucher-2/+3
2016-08-22Rollup merge of #35878 - matthew-piziak:ptr-assertions, r=GuillaumeGomezJonathan Turner-4/+8
replace `println!` statements with `assert!`ions in `std::ptr` examples r? @steveklabnik
2016-08-22Rollup merge of #35864 - matthew-piziak:index-example, r=GuillaumeGomezJonathan Turner-13/+29
replace `Index` example with something more evocative of indexing r? @steveklabnik
2016-08-22Rollup merge of #35861 - matthew-piziak:rem-example, r=GuillaumeGomezJonathan Turner-11/+19
replace `Rem` example with something more evocative r? @steveklabnik
2016-08-22Rollup merge of #35860 - matthew-piziak:mul-example, r=GuillaumeGomezJonathan Turner-10/+47
replace `Mul` example with something more evocative of multiplication I may have gone a bit overboard on this one. Numbers are fun.
2016-08-22Rollup merge of #35809 - matthew-piziak:bitwise-and-example, r=GuillaumeGomezJonathan Turner-12/+27
replace `BitAnd` example with something more evocative of bitwise AND
2016-08-22more evocative examples for `Sub` and `SubAssign`Matthew Piziak-19/+43
These examples are exactly analogous to those in PRs #35709 and #35806. I'll probably remove the `fn main` wrappers for `Add` and `Sub` once this is merged in. Part of #29365. r? @steveklabnik