rename raw_const/mut -> const/mut_addr_of, and stabilize them
This commit is contained in:
parent
d3163e9655
commit
13ffa43bbb
11 changed files with 30 additions and 37 deletions
|
@ -543,8 +543,8 @@ impl<'a, K, V, Type> NodeRef<marker::ValMut<'a>, K, V, Type> {
|
|||
// to avoid aliasing with outstanding references to other elements,
|
||||
// in particular, those returned to the caller in earlier iterations.
|
||||
let leaf = Self::as_leaf_ptr(&mut self);
|
||||
let keys = unsafe { &raw const (*leaf).keys };
|
||||
let vals = unsafe { &raw mut (*leaf).vals };
|
||||
let keys = unsafe { ptr::addr_of!((*leaf).keys) };
|
||||
let vals = unsafe { ptr::addr_of_mut!((*leaf).vals) };
|
||||
// We must coerce to unsized array pointers because of Rust issue #74679.
|
||||
let keys: *const [_] = keys;
|
||||
let vals: *mut [_] = vals;
|
||||
|
|
|
@ -115,7 +115,6 @@
|
|||
#![feature(pattern)]
|
||||
#![feature(ptr_internals)]
|
||||
#![feature(range_bounds_assert_len)]
|
||||
#![feature(raw_ref_op)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(receiver_trait)]
|
||||
#![cfg_attr(bootstrap, feature(min_const_generics))]
|
||||
|
|
|
@ -398,7 +398,7 @@ impl<T> Rc<T> {
|
|||
|
||||
unsafe {
|
||||
let inner = init_ptr.as_ptr();
|
||||
ptr::write(&raw mut (*inner).value, data);
|
||||
ptr::write(ptr::addr_of_mut!((*inner).value), data);
|
||||
|
||||
let prev_value = (*inner).strong.get();
|
||||
debug_assert_eq!(prev_value, 0, "No prior strong references should exist");
|
||||
|
@ -804,7 +804,7 @@ impl<T: ?Sized> Rc<T> {
|
|||
// SAFETY: This cannot go through Deref::deref or Rc::inner because
|
||||
// this is required to retain raw/mut provenance such that e.g. `get_mut` can
|
||||
// write through the pointer after the Rc is recovered through `from_raw`.
|
||||
unsafe { &raw const (*ptr).value }
|
||||
unsafe { ptr::addr_of_mut!((*ptr).value) }
|
||||
}
|
||||
|
||||
/// Constructs an `Rc<T>` from a raw pointer.
|
||||
|
@ -1917,7 +1917,7 @@ impl<T: ?Sized> Weak<T> {
|
|||
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
|
||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||
// so use raw pointer manipulation.
|
||||
unsafe { &raw const (*ptr).value }
|
||||
unsafe { ptr::addr_of_mut!((*ptr).value) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ impl<T> Arc<T> {
|
|||
// reference into a strong reference.
|
||||
unsafe {
|
||||
let inner = init_ptr.as_ptr();
|
||||
ptr::write(&raw mut (*inner).data, data);
|
||||
ptr::write(ptr::addr_of_mut!((*inner).data), data);
|
||||
|
||||
// The above write to the data field must be visible to any threads which
|
||||
// observe a non-zero strong count. Therefore we need at least "Release" ordering
|
||||
|
@ -800,7 +800,7 @@ impl<T: ?Sized> Arc<T> {
|
|||
// SAFETY: This cannot go through Deref::deref or RcBoxPtr::inner because
|
||||
// this is required to retain raw/mut provenance such that e.g. `get_mut` can
|
||||
// write through the pointer after the Rc is recovered through `from_raw`.
|
||||
unsafe { &raw const (*ptr).data }
|
||||
unsafe { ptr::addr_of_mut!((*ptr).data) }
|
||||
}
|
||||
|
||||
/// Constructs an `Arc<T>` from a raw pointer.
|
||||
|
@ -1677,7 +1677,7 @@ impl<T: ?Sized> Weak<T> {
|
|||
// SAFETY: if is_dangling returns false, then the pointer is dereferencable.
|
||||
// The payload may be dropped at this point, and we have to maintain provenance,
|
||||
// so use raw pointer manipulation.
|
||||
unsafe { &raw mut (*ptr).data }
|
||||
unsafe { ptr::addr_of_mut!((*ptr).data) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue