| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
Add const examples
I only added them to `std::f32` to get feedback on this approach before adding the other constants.
When looking at https://github.com/rust-lang/rust/pull/68952, I found the docs a little confusing. Unless you're intimately aware of what's going on here, I don't think it's super clear what is deprecated and what you're supposed to do instead. I think short examples really clarify what's meant here, so that's what I did.
|
|
|
|
Stabilizes the following signed integer functions with saturation
mechanics:
* saturating_abs()
* saturating_neg()
Closes #59983
|
|
Use f64 in f64 examples
I believe that this is a copy/paste error; this example was using f32,
but it's the docs for f64.
|
|
|
|
I believe that this is a copy/paste error; this example was using f32,
but it's the docs for f64.
|
|
|
|
|
|
|
|
|
|
And also point people to use the associated constants of f32 instead.
|
|
|
|
This attempts to be a little clearer (including in terminology) about the lack
of guarantees that any::type_name provides.
|
|
Co-authored-by: Ralf Jung <post@ralfj.de>
|
|
|
|
Add `RefCell::take`
Add `RefCell::take` to match `Cell` and `Option`.
I also changed a couple of calls to `.replace` to `.take`.
Tracking issue is #71395.
This is my first contribution, please tell me if there's anything I could improve, thanks!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rename Unique::empty() -> Unique::dangling()
A `FIXME` comment in `src/libcore/ptr/unique.rs` suggested refactoring `Unique::empty()` to `Unique::dangling()` which this PR does.
|
|
Add clarification on std::cfg macro docs v. #[cfg] attribute
The wording was discussed, to a limited degree in #71679. This tries to
address some confusion I as well as someone else had independently when
looking at this macro.
Fixes #71679
|
|
document missing stable counterparts of intrinsics
Notes the stable counterpart of each intrinsic in case one exists.
Implements #34338
r? @Dylan-DPC
|
|
rename-unique: Change calls and doc in raw_vec.rs
rename-unique: Change empty() -> dangling() in const-ptr-unique-rpass.rs
|
|
Co-Authored-By: kennytm <kennytm@gmail.com>
|
|
The wording was discussed, to a limited degree in #71679. This tries to
address some confusion I as well as someone else had independently when
looking at this macro.
Fixes #71679
|
|
Fix doc link to Eq trait from PartialEq trait
The `Eq` link was incorrectly going to the `eq` method of `PartialEq`
instead of to the `Eq` trait.
|
|
r=Mark-Simulacrum
Document unsafety in core::ptr
Contributes to #66219
I have yet to document all the `unsafe` blocks in the lib and would like to know if I'm headed in the right direction
r? @steveklabnik
|
|
The `Eq` link was incorrectly going to the `eq` method of `PartialEq`
instead of to the `Eq` trait.
|
|
|
|
Add documentation example to slice_from_raw_parts_mut()
Add SAFETY explanations to some unsafe blocks in libcore/ptr
* libcore/ptr/mod.rs
* libcore/ptr/unique.rs
* libcore/ptr/non_null.rs
safety-mod.rs: Add SAFETY to slice_from_raw_parts(),
slice_from_raw_parts_mut()
slice_from_raw_parts_mut: Add documentation example
safety-ptr-unique.rs: Add SAFETY to new() and cast()
safety-ptr-non_null.rs: Add SAFETY to new()
safety-ptr-non_null.rs: Add SAFETY to cast()
safety-ptr-non_null.rs: Add SAFETY to from() impls
safety-ptr-unique.rs: Add SAFETY to from() impls
safety-ptr-non_null.rs: Add SAFETY to new()
safety-ptr-unique.rs: Add SAFETY to new()
safety-ptr-mod.rs: Fix safety explanation
https://github.com/rust-lang/rust/pull/71507#discussion_r414488884
safety-prt-non_null.rs: Fix SAFETY comment syntax
safety-ptr-unique.rs: Fix syntax for empty()
safety-ptr-non_null.rs: Fix misuse of non-null for align_of()
safety-ptr-non_null.rs: Remove incorrect SAFETY comment
safety-ptr-unique.rs: Remove unsound SAFETY comment
safety-ptr-mod.rs: Add std comment on slice_from_raw_parts guarantee
safety-ptr-unique.rs: Remove incorrect safety comment
Creating a Unique from a NonNull has strict guarantees that the current
implementation does not guarantee
https://github.com/rust-lang/rust/pull/71507#discussion_r415035952
safety-ptr: Re-adding ignore-tidy directive
|
|
|
|
|
|
remove Unique::from for shared pointer types
r? @SimonSapin
|
|
|
|
- Remove a type parameter from `[A]RcFromIter`.
- Remove an implementation of `[A]RcFromIter` that didn't actually
specialize anything.
- Remove unused implementation of `IsZero` for `Option<&mut T>`.
- Change specializations of `[A]RcEqIdent` to use a marker trait version
of `Eq`.
- Remove `BTreeClone`. I couldn't find a way to make this work with
`min_specialization`.
- Add `rustc_unsafe_specialization_marker` to `Copy` and `TrustedLen`.
|
|
In the same vein as `Cell::take` and `Option::take`.
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`)
- #69813 (Implement BitOr and BitOrAssign for the NonZero integer types)
- #70712 (stabilize BTreeMap::remove_entry)
- #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`)
- #71544 (Replace filter_map().next() calls with find_map())
- #71545 (Fix comment in docstring example for Error::kind)
- #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.)
Failed merges:
r? @ghost
|
|
Implement BitOr and BitOrAssign for the NonZero integer types
This provides overloaded operators for `NonZero$Int | NonZero$Int`, `NonZero$Int | $Int`, and `$Int | NonZero$Int`. It also provides `BitOrAssign` where `self` is `NonZero$Int`, for symmetry.
It's a pretty small conceptual addition, but is good becasue but avoids a case where the operation is obviously sound, but you'd otherwise need unsafe to do it.
In crates trying to minimize `unsafe` usage, this is unfortunate and makes working with `NonZero` types often not worth it, even if the operations you're doing are clearly sound.
I've marked these as stable as I've been told in the past that trait impls are automatically stable. I'm happy to change it to unstable if this wasn't correct information.
I'm not entirely confident what version I should have put down, so I followed https://www.whatrustisit.com. Hopefully it's correct for this.
Apologies in advance if this has come up before, but I couldn't find it.
|
|
Bump bootstrap compiler
This bumps the bootstrap compiler and the rustfmt that x.py fmt uses.
|
|
|
|
|
|
Improve PanicInfo examples readability
cc @Eijebong
r? @Dylan-DPC
|
|
more compact way to adjust test sizes for Miri
Inspired by @dtolnay
|
|
|