| Age | Commit message (Collapse) | Author | Lines |
|
docs order
See https://github.com/rust-lang/rust/issues/47115#issuecomment-392532855
|
|
Various minor slice iterator cleanups
See individual commits
|
|
const fn integer operations
A follow up to #51171
Fixes #51267
Makes a lot of the integer methods (`swap_bytes`, `count_ones` etc) `const fn`s. See #51267 for a discussion about why this is wanted and the solution used.
|
|
|
|
These don't exist anymore.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl Default for &mut str
Rationale: There is already `impl Default for &mut [T]`.
Note: This impl is insta-stable.
|
|
Make Layout's align a NonZeroUsize
This PR makes the `Layout`'s align field a `NonZeroUsize` since it cannot ever be zero, not even while building a `Layout`. It also contains some drive-by minor cleanups over the docs and the code, like updating the documented error types, or using the `size()` and `align()` methods instead of accessing the fields directly (the latter was required for the `NonZeroUsize` change anyways).
r? @SimonSapin
cc @Amanieu
|
|
Stabilize SliceIndex trait.
CC #35729
According to recommendations in
https://github.com/rust-lang/rust/issues/35729#issuecomment-377784884
|
|
Reword {ptr,mem}::replace docs.
Fixes https://github.com/rust-lang/rust/issues/50657.
|
|
Provide more context for what the {f32,f64}::EPSILON values represent.
Introduce the 'machine epsilon' term because if one googles 'epsilon', they might stumble upon https://en.wikipedia.org/wiki/Epsilon_numbers_(mathematics) instead of https://en.wikipedia.org/wiki/Machine_epsilon
|
|
Add as_nanos function to Duration
Duration has historically lacked a way to get the actual number of nanoseconds it contained as a normal Rust type because u64 was of insufficient range, and f64 of insufficient precision. The u128 type solves both issues, so I propose adding an `as_nanos` function to expose the capability.
|
|
|
|
|
|
|
|
|
|
|
|
Add From<bool> for int types
Fixes #46109.
|
|
Fixes https://github.com/rust-lang/rust/issues/50657.
|
|
r=QuietMisdreavus
Add missing whitespace in num example
r? @QuietMisdreavus
|
|
Replace `if` with `if and only if` in the definition dox of `Sync`
The old text was: "The precise definition is: a type `T` is `Sync` if `&T` is Send."
Since we've also got
```
impl<'a, T> Send for &'a T
where
T: Sync + ?Sized,
```
I purpose we can change the `if` to `if and only if` to make it more precise.
|
|
|
|
|
|
|
|
|
|
Fixes #35729
According to recommendations in
https://github.com/rust-lang/rust/issues/35729#issuecomment-377784884
|
|
The old text was: "The precise definition is: a type T is Sync if &T is Send."
Since we've also got
```
impl<'a, T> Send for &'a T
where
T: Sync + ?Sized,
```
I purpose we can change the `if` to `if and only if` to make it more precise.
|
|
Arc downcast
Implement `downcast` for `Arc<Any + Send + Sync>` as part of #44608, and gated by the same `rc_downcast` feature.
This PR is mostly lightly-edited cut'n'paste.
This has two additional changes:
- The `downcast` implementation needs `Any + Send + Sync` implementations for `is` and `Debug`, and I added `downcast_ref` and `downcast_mut` for completeness/consistency. (Can these be insta-stabilized?)
- At @SimonSapin's suggestion, I converted `Arc` and `Rc` to use `NonNull::cast` to avoid an `unsafe` block in each which tidied things up nicely.
|
|
|
|
Make the Any+Send+Sync examples use the right trait bounds, and fix a small whitespace issue.
|
|
Implement `is`, `downcast_ref`, `downcast_mut` and `Debug` for
`Any + Send + Sync`.
|
|
mod.rs isn't beautiful
I hate this spaces.
|
|
|
|
|
|
|
|
extend from_raw_parts docs for slices and strs to mention alignment requirement
The documentation for `str::from_raw_parts_mut` seems to not be visible because that method is private, bit I figured it could still be fixed. I also removed the reference to the no-longer-existing `str::from_raw_parts` while I was at it.
Alternatively, should I remove `str::from_raw_parts_mut` completely? it is only used in `str::split_at_mut`, where it might as well be inlined.
|
|
Document additional use case for iter::inspect
Adds docs for `iter::inspect` showing the non-debug use case
Closes #49564
|
|
|
|
|
|
Add missing Wrapping methods, use doc_comment!
Re-opened version of #49393 . Finishing touches for #32463.
Note that this adds `Shl` and `Shr` implementations for `Wrapping<i128>` and `Wrapping<u128>`, which were previously missed. This is technically insta-stable, but I don't know why this would be a problem.
|
|
str::from_raw_parts has been removed long ago because it can be obtained via
str::from_utf8_unchecked and slice::from_raw_parts. The same goes for
str::from_raw_parts_mut.
|
|
|
|
|
|
Stabilize Formatter alignment
Fixes #27726.
cc @SimonSapin
|
|
|