summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-04-24Add more explanation on RefCell::get_mutGuillaume Gomez-0/+9
2017-04-23Auto merge of #41437 - cuviper:remove-unstable-deprecated, r=alexcrichtonbors-325/+74
Remove items that are unstable and deprecated This removes unstable items that have been deprecated for more than one cycle. - Since 1.16.0, `#![feature(enumset)]` - All of `mod collections::enum_set` - Since 1.15.0, `#![feature(borrow_state)]` - `cell::BorrowState` - `RefCell::borrow_state()` - Since 1.15.0, `#![feature(is_unique)]` - `Rc::is_unique()` (made private like `Arc::is_unique()`) - Since 1.15.0, `#![feature(rc_would_unwrap)]` - `Rc::would_wrap()` - Since 1.13.0, `#![feature(binary_heap_extras)]` - `BinaryHeap::push_pop()` - `BinaryHeap::replace()` - Since 1.12.0, `#![feature(as_unsafe_cell)]` - `Cell::as_unsafe_cell()` - `RefCell::as_unsafe_cell()` - Since 1.12.0, `#![feature(map_entry_recover_keys)]` - `btree_map::OccupiedEntry::remove_pair()` - `hash_map::OccupiedEntry::remove_pair()` - Since 1.11.0, `#![feature(float_extras)]` - `Float::nan()` - `Float::infinity()` - `Float::neg_infinity()` - `Float::neg_zero()` - `Float::zero()` - `Float::one()` - `Float::integer_decode()` - `f32::integer_decode()` - `f32::ldexp()` - `f32::frexp()` - `f32::next_after()` - `f64::integer_decode()` - `f64::ldexp()` - `f64::frexp()` - `f64::next_after()` - Since 1.11.0, `#![feature(zero_one)]` - `num::Zero` - `num::One`
2017-04-21Auto merge of #41349 - eddyb:ty-contents, r=nikomatsakisbors-0/+17
rustc: replace TypeContents with two independent properties (is_freeze / needs_drop). `InteriorUnsafe` / `interior_unsafe` was replaced with a private lang-item `Freeze` auto trait in libcore. `OwnsDtor` / `needs_drop` was replaced with a specialized traversal that *doesn't* avoid caching results in case of a cycle, as the only cycles left can only occur in erroneous "types with infinite sizes", references and raw pointers not having destructors. Also, `Copy` is now checked at every step of the recursion. r? @nikomatsakis
2017-04-20Remove float_extrasJosh Stone-162/+71
[unstable, deprecated since 1.11.0]
2017-04-20Remove num::{Zero,One}Josh Stone-74/+3
[unstable, deprecated since 1.11.0]
2017-04-20Remove RefCell::borrow_stateJosh Stone-46/+0
[unstable, deprecated since 1.15.0]
2017-04-20Remove {Cell,RefCell}::as_unsafe_cellJosh Stone-43/+0
[unstable, deprecated since 1.12.0]
2017-04-20Rollup merge of #40987 - maccoda:convert-docs, r=steveklabnikCorey Farwell-50/+133
API docs: Convert Clean up of the convert module documentation following points in #29349
2017-04-20rustc: replace interior_unsafe with a Freeze trait.Eduard-Mihai Burtescu-0/+17
2017-04-18Fix a few stability attributesOliver Middleton-5/+5
These show up in rustdoc so need to be correct.
2017-04-17Rollup merge of #41262 - jonhoo:compiler-barrier-rename, r=alexcrichtonCorey Farwell-6/+6
Rename compiler_barrier to compiler_fence This addresses concerns raised following the merge of #41092. Specifically: > The naming of these seems surprising: the multithreaded functions (and both the single and multithreaded intrinsics themselves) are fences, but this is a barrier. It's not incorrect, but the latter is both inconsistent with the existing functions and slightly confusing with another type in std (e.g., `Barrier`). `compiler_fence` carries the same semantic implication that this is a compiler-only operation, while being more in line with the fence/barrier concepts already in use in `std`.
2017-04-18Address review commentsDylan Maccora-24/+19
2017-04-15Auto merge of #39881 - king6cong:sys, r=japaricbors-5/+5
code format
2017-04-15code formatking6cong-5/+5
2017-04-14Rollup merge of #41125 - lukaramu:std-hash-docs, r=frewsxcvCorey Farwell-33/+164
Improve std::hash docs Fixes #29357. For details on what exactly I've done, see the commit descriptions. There are some things I'm not sure about, but would like to address before merging this so the issue can be closed; any feedback on these points would really be appriciated: * [x] ~I didn't touch the module level docs at all. On the one hand, I think they could use a short overview over the module; on the other hand, the module really isn't that big and I don't know if I could really do anything beyond just duplicating the type's summaries...~ * [x] ~I feel like the module-level examples are quite long-winded and not to the point, but I couldn't really think of anything better. Any ideas?~ * [x] ~Should `Hasher` get an example for implementing it? There is one in the module documentation, but it only "implements" it via `unimplemented!` and I'm not sure what the value of that is.~ * [x] ~Should `Hasher`'s `write_{int}` methods get examples?~ If there's anything else you'd like to see in std::hash's docs, please let me know! r? @rust-lang/docs
2017-04-14Use associated constants in core::num::dec2fltRobin Kruppe-152/+99
2017-04-13Rename compiler_barrier to compiler_fenceJon Gjengset-6/+6
This addresses concerns raised following the merge of #41092. Specifically: > The naming of these seems surprising: the multithreaded functions (and > both the single and multithreaded intrinsics themselves) are fences, > but this is a barrier. It's not incorrect, but the latter is both > inconsistent with the existing functions and slightly confusing with > another type in std (e.g., `Barrier`). `compiler_fence` carries the same semantic implication that this is a compiler-only operation, while being more in line with the fence/barrier concepts already in use in `std`.
2017-04-11Rollup merge of #41216 - shahn:iter_pos, r=steveklabnikCorey Farwell-2/+6
Clarify Iterator::position doc Extend the example a little bit to show behaviour better. r? @steveklabnik
2017-04-11Rollup merge of #40559 - nagisa:manually-drop, r=alexcrichtonCorey Farwell-22/+131
Implement Manually Drop As the RFC has been from approx a week in FCP without any major comments, I’m taking the opportunity to submit the PR early.
2017-04-11Clarify Iterator::position docSebastian Hahn-2/+6
Extend the example a little bit to show behaviour better.
2017-04-11Auto merge of #41096 - clarcharr:as_bytes_mut, r=alexcrichtonbors-8/+34
Reduce str transmutes, add mut versions of methods. When I was working on the various parts involved in #40380 one of the comments I got was the excess of transmutes necessary to make the changes work. This is part of a set of multiple changes I'd like to offer to fix this problem. I think that having these methods is reasonable because they're already possible via transmutes, and it makes the code that uses them safer. I can also add `pub(crate)` to these methods for now if the libs team would rather not expose them to the public without an RFC.
2017-04-10Auto merge of #40565 - estebank:binops-help, r=arielb1bors-0/+22
Explicit help message for binop type mismatch When trying to do `1 + Some(2)`, or some other binary operation on two types different types without an appropriate trait implementation, provide an explicit help message: ```rust help: `{integer} + std::option::Option<{integer}>` has no implementation ``` Re: #39579, #38564, #37626, #39942, #34698.
2017-04-10Explicit help message for binop type missmatchEsteban Küber-0/+22
When trying to do a binary operation with missing implementation, for example `1 + Some(2)`, provide an explicit help message: ``` note: no implementation for `{integer} + std::option::Option<{integer}>` ``` Use `rustc_on_unimplemented` for the suggestions. Move cfail test to ui.
2017-04-10Fixed indent, grammar, and link in std::hash docslukaramu-4/+4
2017-04-10Auto merge of #41179 - mandeep:add-fmtresult-example, r=frewsxcvbors-1/+24
Added doc comments for fmt::Result Added doc comments for fmt::Result in regards to item 3 in issue #29355. I'm not certain that this is all that's needed but I think it's a good starting point on this item.
2017-04-09Added doc comments for fmt::Resultmandeep-1/+24
2017-04-09Reduce str transmutes, add mut versions of methods.Clar Charr-8/+34
2017-04-09into_inner to associated functionSimonas Kazlauskas-2/+19
2017-04-09 Replace the `forget` intrinsic with ManuallyDropSimonas Kazlauskas-4/+6
less intrinsics = better life
2017-04-09Move away from the ad-hoc NoDrop unionsSimonas Kazlauskas-18/+12
2017-04-09Implement Manually DropSimonas Kazlauskas-0/+96
2017-04-09Auto merge of #41154 - bluss:slice-rfind, r=alexcrichtonbors-0/+27
Implement .rfind() for slice iterators Iter and IterMut Just like the forward case find, implement rfind explicitly for slice iterators Iter and IterMut.
2017-04-08Auto merge of #41092 - jonhoo:std-fence-intrinsics, r=alexcrichtonbors-0/+41
Add safe wrapper for atomic_compilerfence intrinsics This PR adds a proposed safe wrapper for the `atomic_singlethreadfence_*` intrinsics introduced by [RFC #888](https://github.com/rust-lang/rfcs/pull/888). See #41091 for further discussion.
2017-04-08slice: Implement .rfind() for slice iterators Iter and IterMutUlrik Sverdrup-0/+27
Just like the forward case find, implement rfind explicitly
2017-04-08Removing broken examplesDylan Maccora-24/+3
2017-04-07Replace compare_exchange with swapStjepan Glavina-8/+3
2017-04-07Optimize AtomicBool::fetch_nandStjepan Glavina-10/+27
2017-04-07improved std::hash::Hasher docslukaramu-2/+57
Part of #29357. * rephrased summary sentences to be less redundant * expanded top-level docs, adding a usage example and links to relevant methods (`finish`, `write` etc) as well as `Hash` * added examples to the `finish` and `write` methods
2017-04-06improved std::hash::Hash docslukaramu-22/+61
Part of #29357. * merged "Derivable" and "How can I implement `Hash`?" sections into one "Implementing `Hash`" section to aid coherency * added an example for `#[derive(Hash)]` * moved part about relation between `Hash` and `Eq` into a new "`Hash` and `Eq`" section; changed wording to be more consistent with `HashMap` and `HashSet`'s * explicitly mentioned `#[derive(PartialEq, Eq, Hash)]` in the new section * changed method summaries for consistency, adding links and examples
2017-04-06improved std::hash::BuildHasher docslukaramu-5/+33
Part of #29357. * split summary and explanation more clearly, while expanding the explanation to make the reason for `BuildHasher` existing more clear * added an example illustrating that `Hasher`s created by one `BuildHasher` should be identical * added links * repeated the fact that hashers produced should be identical in `build_hasher`s method docs
2017-04-06rephrased std::hash::BuildHasherDefault docslukaramu-4/+13
Part of #29357. * split summary and explanation more clearly * added link to nomicon for "zero-sized" * "does not need construction" -> say how it can be created, and that it doesn't need to be done with `HashMap` or `HashSet`
2017-04-06Fix Markdown issues in the docsOliver Middleton-2/+3
* Since the switch to pulldown-cmark reference links need a blank line before the URLs. * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-04-06Add unstable book entryJon Gjengset-1/+1
2017-04-05Rollup merge of #41037 - stjepang:move-libxtest, r=alexcrichtonCorey Farwell-6/+7667
Move libXtest into libX/tests This change moves: 1. `libcoretest` into `libcore/tests` 2. `libcollectionstest` into `libcollections/tests` This is a follow-up to #39561. r? @alexcrichton
2017-04-05Rollup merge of #41065 - jorendorff:slice-rsplit-41020, r=alexcrichtonAriel Ben-Yehuda-17/+148
[T]::rsplit() and rsplit_mut(), #41020
2017-04-05Rollup merge of #41028 - bluss:rev-rfind, r=alexcrichtonAriel Ben-Yehuda-1/+13
Let .rev()'s find use the underlying rfind and vice versa - Connect the plumbing in an obvious way from Rev's find → underlying rfind and vice versa - A style change in the provided implementation for Iterator::rfind, using simple next_back when it is enough
2017-04-05Rollup merge of #40943 - Amanieu:offset_to, r=alexcrichtonAriel Ben-Yehuda-3/+80
Add ptr::offset_to This PR adds a method to calculate the signed distance (in number of elements) between two pointers. The resulting value can then be passed to `offset` to get one pointer from the other. This is similar to pointer subtraction in C/C++. There are 2 special cases: - If the distance is not a multiple of the element size then the result is rounded towards zero. (in C/C++ this is UB) - ZST return `None`, while normal types return `Some(isize)`. This forces the user to handle the ZST case in unsafe code. (C/C++ doesn't have ZSTs)
2017-04-05Rollup merge of #40927 - stjepang:docs-atomic-overflow-note, r=alexcrichtonAriel Ben-Yehuda-10/+29
Add a note about overflow for fetch_add/fetch_sub Fixes #40916 Fixes #34618 r? @steveklabnik
2017-04-05Rollup merge of #40709 - lifthrasiir:leaner-unicode-debug-str, r=alexcrichtonAriel Ben-Yehuda-771/+467
Reduce a table used for `Debug` impl of `str`. This commit shrinks the size of the aforementioned table from 2,102 bytes to 1,197 bytes. This is achieved by an observation that most `u16` entries are common in its upper byte. Specifically: - `SINGLETONS` now uses two tables, one for (upper byte, lower count) and another for a series of lower bytes. For each upper byte given number of lower bytes are read and compared. - `NORMAL` now uses a variable length format for the count of "true" codepoints and "false" codepoints (one byte with MSB unset, or two big-endian bytes with the first MSB set). The code size and relative performance roughly remains same as this commit tries to optimize for both. The new table and algorithm has been verified for the equivalence to older ones. In my x86-64 macOS laptop with `rustc 1.17.0-nightly (0aeb9c129 2017-03-15)`, `-C opt-level=3 -C lto` gives the following: * The old routine compiles to 2,102 bytes of data and 416 bytes of code. * The new routine compiles to 1,197 bytes of data and 448 bytes of code. Counting a number of all printable Unicode scalar values (128,003, if you wonder) by filtering `0..0x110000` with `std::char::from_u32` and `is_printable` took 50±7ms for both. This can be surprising as the new routine *has* to do more calculations; this is partly explained by the fact that a linear search of `SINGLETONS` has been replaced by *two* linear searches for upper and lower bytes, which greatly reduces the iteration count.
2017-04-05Add safe wrapper for atomic_singlethreadfence_*Jon Gjengset-0/+41