Skip to content

Commit

Permalink
Rollup merge of #80886 - RalfJung:stable-raw-ref-macros, r=m-ou-se
Browse files Browse the repository at this point in the history
Stabilize raw ref macros

This stabilizes `raw_ref_macros` (rust-lang/rust#73394), which is possible now that rust-lang/rust#74355 is fixed.

However, as I already said in rust-lang/rust#73394 (comment), I am not particularly happy with the current names of the macros. So I propose we also change them, which means I am proposing to stabilize the following in `core::ptr`:
```rust
pub macro const_addr_of($e:expr) {
    &raw const $e
}

pub macro mut_addr_of($e:expr) {
    &raw mut $e
}
```

The macro name change means we need another round of FCP. Cc `````@rust-lang/libs`````
Fixes #73394
  • Loading branch information
JohnTitor committed Jan 30, 2021
2 parents e311741 + e416047 commit d39754d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,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;
Expand Down

0 comments on commit d39754d

Please sign in to comment.