| Age | Commit message (Collapse) | Author | Lines |
|
Fix typo in RawWaker::new documentation
poiner -> pointer
|
|
add spaces in front of trait requirements in libcore/cell.rs
Adds spaces before trait requirements in `libcore/cell.rs`.
|
|
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
|
|
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
|
|
r=QuietMisdreavus
Add missing links for CannotReallocInPlace type
r? @QuietMisdreavus
|
|
r=QuietMisdreavus
Fix Pin urls in Option documentation
Fixes the following situation:

r? @QuietMisdreavus
|
|
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
|
|
poiner -> pointer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Also modifies the generation script to emit 2018 edition paths.
|
|
|
|
|
|
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.
|
|
r=scottmcm
Add messages to `Option`'s and `Result`'s `must_use` annotation for `is_*`
r? @RalfJung
|
|
|
|
|
|
|
|
These are `Option` analogues to `Result::expect_err` and `unwrap_err`.
|
|
Like references and boxes, moving the pointer doesn't move the
pointed-to value, so this is safe.
|
|
Fix typo in libcore/intrinsics.rs
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
#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>
|
|
Use `fold` in `Iterator::last` default implementation
We already use it in all the other methods. Consistency + potential perf is a pretty nice win!
|
|
|
|
Replace last impl with fold
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
`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.
|
|
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
|
|
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
|
|
|
|
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.
|
|
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`.
|
|
|