about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-07-15Rollup merge of #62689 - 0e4ef622:patch-1, r=XanewokMark Rousskov-1/+1
Fix typo in RawWaker::new documentation poiner -> pointer
2019-07-15Rollup merge of #62662 - DutchGhost:fix_space, r=sfacklerMark Rousskov-6/+6
add spaces in front of trait requirements in libcore/cell.rs Adds spaces before trait requirements in `libcore/cell.rs`.
2019-07-15Rollup merge of #62639 - immunant:invariant_valistimpl, r=eddybMark Rousskov-5/+8
Make VaListImpl<'f> invariant over the 'f lifetime After doing some research on variance and going back to look at `VaList` and `VaListImpl`, I realized that `VaList<'a, 'f>` is invariant over the `'f` lifetime (and covariant over `'a`), but `VaListImpl<'f>` isn't invariant but probably should be. This patch makes `VaListImpl<'f>` invariant over `'f`. r? @eddyb cc @dlrobertson
2019-07-15Rollup merge of #62634 - llogiq:uninit-array-docs, r=RalfJungMark Rousskov-5/+7
Less unsafe in the array example of MaybeUninit docs I believe this is an acceptable way to initialize elements of `[MaybeUninit<T>; _]` arrays. Miri agrees. Conceptually, we are working at the array level, above the `MaybeUninit`, and as we are replacing it wholesale, this should pose no problem to soundness. And the code is easier to read. r? @RalfJung
2019-07-15Rollup merge of #62533 - GuillaumeGomez:missing-urls-CannotReallocInPlace, ↵Mark Rousskov-2/+5
r=QuietMisdreavus Add missing links for CannotReallocInPlace type r? @QuietMisdreavus
2019-07-15Rollup merge of #62491 - GuillaumeGomez:fix-pin-urls-for-option, ↵Mark Rousskov-0/+4
r=QuietMisdreavus Fix Pin urls in Option documentation Fixes the following situation: ![Screenshot from 2019-07-08 13-24-59](https://user-images.githubusercontent.com/3050060/60806822-55dfdc00-a184-11e9-9ee3-279e82fc92bd.png) r? @QuietMisdreavus
2019-07-15Rollup merge of #62103 - RalfJung:debug-assert, r=alexcrichtonMark Rousskov-4/+35
Add debug assertions to write_bytes and copy* Looks like @nitnelave went MIA in https://github.com/rust-lang/rust/pull/58783, so I am re-submitting their PR, tweaked just a bit. I took care to preserve commit authorship. Cc https://github.com/rust-lang/rust/issues/53871
2019-07-15Fix typo in RawWaker::new documentation0e4ef622-1/+1
poiner -> pointer
2019-07-15Add debug assertions to write_bytes and copy*Valentin Tolmer-4/+35
2019-07-15Add rtm and f16c features to libcoregnzlbg-0/+2
2019-07-15Update the stdarch submodulegnzlbg-2/+2
2019-07-14Make VaListImpl<'f> invariant over the 'f lifetimeAndrei Homescu-5/+8
2019-07-14Less unsafe in the array example of MaybeUninit docsAndre Bogus-5/+7
2019-07-14better commentsRalf Jung-3/+4
2019-07-13add spaces in front of trait requirementsDodo-6/+6
2019-07-13explain how to search without owned dataRalf Jung-0/+8
2019-07-12allow clippy::unreadable_literal in unicode tablesAndy Russell-4/+4
Also modifies the generation script to emit 2018 edition paths.
2019-07-12Regenerate character tables for Unicode 12.1Josh Stone-734/+765
2019-07-12Update unicode scripts for the current coding styleJosh Stone-5/+5
2019-07-12Rollup merge of #62599 - RalfJung:uninit, r=cramertjMazdak Farrokhzad-1/+1
move mem::uninitialized deprecation back by 1 release, to 1.39 As per discussion at https://github.com/rust-lang/rust/issues/53491#issuecomment-509271182. Three releases also agrees with the precedent from `trim_left/right`. Three releases means that even nightly users (including rustc itself) get a full cycle from when the announcement is made in the stable release to when nightly starts to warn.
2019-07-12Rollup merge of #62431 - czipperz:add-messages-to-must-use-is_-methods, ↵Mazdak Farrokhzad-4/+5
r=scottmcm Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*` r? @RalfJung
2019-07-12Add tracking issue 62633Josh Stone-2/+2
2019-07-11move mem::uninitialized deprecation back by 1 release, to 1.39Ralf Jung-1/+1
2019-07-11Make cold unwraps take &dyn DebugJosh Stone-8/+8
2019-07-11Add Option::expect_none(msg) and unwrap_none()Josh Stone-1/+94
These are `Option` analogues to `Result::expect_err` and `unwrap_err`.
2019-07-10Implement Unpin for all raw pointersSteven Fackler-0/+6
Like references and boxes, moving the pointer doesn't move the pointed-to value, so this is safe.
2019-07-11Rollup merge of #62557 - taiki-e:typo, r=CentrilMazdak Farrokhzad-1/+2
Fix typo in libcore/intrinsics.rs
2019-07-11Rollup merge of #62476 - petrochenkov:expref, r=matthewjasperMazdak Farrokhzad-2/+5
Continue refactoring macro expansion and resolution This PR continues the work started in https://github.com/rust-lang/rust/pull/62042. It contains a set of more or less related refactorings with the general goal of making things simpler and more orthogonal. Along the way most of the issues uncovered in https://github.com/rust-lang/rust/pull/62086 are fixed. The PR is better read in per-commit fashion with whitespace changes ignored. I tried to leave some more detailed commit messages describing the motivation behind the individual changes. Fixes https://github.com/rust-lang/rust/issues/44692 Fixes https://github.com/rust-lang/rust/issues/52363 Unblocks https://github.com/rust-lang/rust/pull/62086 r? @matthewjasper
2019-07-11Rollup merge of #61665 - aschampion:slice-eq-ptr, r=sfacklerMazdak Farrokhzad-6/+17
core: check for pointer equality when comparing Eq slices Because `Eq` types must be reflexively equal, an equal-length slice to the same memory location must be equal. This is related to #33892 (and #32699) answering this comment from that PR: > Great! One more easy question: why does this optimization not apply in the non-BytewiseEquality implementation directly above? Because slices of non-reflexively equal types (like `f64`) are not equal even if it's the same slice. But if the types are `Eq`, we can use this same-address optimization, which this PR implements. Obviously this changes behavior if types violate the reflexivity condition of `Eq`, because their impls of `PartialEq` will no longer be called per-item, but 🤷‍♂ . It's not clear how often this optimization comes up in the real world outside of the same-`&str` case covered by #33892, so **I'm requesting a perf run** (on MacOS today, so can't run `rustc_perf` myself). I'm going ahead and making the PR on the basis of being surprised things didn't already work this way. This is my first time hacking rust itself, so as a perf sanity check I ran `./x.py bench --stage 0 src/lib{std,alloc}`, but the differences were noisy. To make the existing specialization for `BytewiseEquality` explicit, it's now a supertrait of `Eq + Copy`. `Eq` should be sufficient, but `Copy` was included for clarity.
2019-07-11hygiene: Fix wording of desugaring descriptionsVadim Petrochenkov-2/+2
Use variant names rather than descriptions for identifying desugarings in `#[rustc_on_unimplemented]`. Both are highly unstable, but variant name is at least a single identifier.
2019-07-11Remove unnecessary expansions created by `#[test_case/test/bench]`Vadim Petrochenkov-0/+3
The expansions were created to allow unstable things inside `#[test_case/test/bench]`, but that's not a proper way to do that. Put the required `allow_internal_unstable`s into the macros' properties instead.
2019-07-10Rollup merge of #62493 - Freyskeyd:valid_example_read-write_unaligned, r=rkruppeMazdak Farrokhzad-0/+32
#62357: doc(ptr): add example for {read,write}_unaligned related to #62357 > With #62323 the only example (that had UB and was thus invalid) in std::ptr::read_unaligned and std::ptr::write_unaligned is removed. > We should add a valid example of using the aforementioned functions. Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2019-07-10Rollup merge of #62481 - czipperz:iterator-last-nth-use-for_each, r=scottmcmMazdak Farrokhzad-3/+1
Use `fold` in `Iterator::last` default implementation We already use it in all the other methods. Consistency + potential perf is a pretty nice win!
2019-07-10Fix typo in libcore/intrinsics.rsTaiki Endo-1/+2
2019-07-09Use fold in Iterator::lastChris Gregory-3/+1
Replace last impl with fold
2019-07-10Rollup merge of #62278 - cuviper:iter-partition, r=alexcrichtonMazdak Farrokhzad-0/+138
Add Iterator::partition_in_place() and is_partitioned() `partition_in_place()` swaps `&mut T` items in-place to satisfy the predicate, so all `true` items precede all `false` items. This requires a `DoubleEndedIterator` so we can search from front and back for items that need swapping. `is_partitioned()` checks whether the predicate is already satisfied.
2019-07-09Tracking issue 62544 for iter_is_partitionedJosh Stone-1/+1
2019-07-09Tracking issue 62543 for iter_partition_in_placeJosh Stone-1/+1
2019-07-09Implement DoubleEndedIterator for iter::{StepBy, Peekable, Take}Tim Vermeulen-13/+296
2019-07-09Unit test Iterator::partition_in_place and is_partitionedJosh Stone-0/+38
2019-07-09Return the true count from partition_in_placeJosh Stone-6/+35
2019-07-09Rename partition_mut to partition_in_placeJosh Stone-8/+8
2019-07-09Capitalize example commentJosh Stone-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-09Add Iterator::partition_mut() and is_partitioned()Josh Stone-0/+71
`partition_mut()` swaps `&mut T` items in-place to satisfy the predicate, so all `true` items precede all `false` items. This requires a `DoubleEndedIterator` so we can search from front and back for items that need swapping. `is_partitioned()` checks whether the predicate is already satisfied.
2019-07-09Apply suggestions from code reviewAleksey Kladov-3/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-09doc(ptr): add example for {read,write}_unalignedFreyskeyd-0/+32
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2019-07-09Add missing links for CannotReallocInPlace typeGuillaume Gomez-2/+5
2019-07-09clarify that debug_assert does not completely omits the codeAleksey Kladov-6/+6
TIL that debug_assert is implemented using `if cfg!(debug_assertions)` rather than `#[cfg(debug_assertions)]`. This means one can not use API gated with `#[cfg(debug_assertions)]` in `debug_assert` family of macros.
2019-07-09Rollup merge of #60458 - KodrAus:debug_map_entry, r=alexcrichtonMazdak Farrokhzad-25/+229
Add key and value methods to DebugMap Implementation PR for an active (not approved) RFC: https://github.com/rust-lang/rfcs/pull/2696. Add two new methods to `std::fmt::DebugMap` for writing the key and value part of a map entry separately: ```rust impl<'a, 'b: 'a> DebugMap<'a, 'b> { pub fn key(&mut self, key: &dyn Debug) -> &mut Self; pub fn value(&mut self, value: &dyn Debug) -> &mut Self; } ``` I want to do this so that I can write a `serde::Serializer` that forwards to our format builders, so that any `T: Serialize` can also be treated like a `T: Debug`.
2019-07-09add feature to docsAshley Mannix-0/+2