@@ -1501,7 +1501,6 @@ fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L }
1501
1501
/// # Example
1502
1502
///
1503
1503
/// ```
1504
- /// #![feature(raw_ref_macros)]
1505
1504
/// use std::ptr;
1506
1505
///
1507
1506
/// #[repr(packed)]
@@ -1512,14 +1511,14 @@ fnptr_impls_args! { A, B, C, D, E, F, G, H, I, J, K, L }
1512
1511
///
1513
1512
/// let packed = Packed { f1: 1, f2: 2 };
1514
1513
/// // `&packed.f2` would create an unaligned reference, and thus be Undefined Behavior!
1515
- /// let raw_f2 = ptr::raw_const !(packed.f2);
1514
+ /// let raw_f2 = ptr::addr_of !(packed.f2);
1516
1515
/// assert_eq!(unsafe { raw_f2.read_unaligned() }, 2);
1517
1516
/// ```
1518
- #[ unstable ( feature = "raw_ref_macros" , issue = "73394 " ) ]
1517
+ #[ stable ( feature = "raw_ref_macros" , since = "1.51.0 " ) ]
1519
1518
#[ rustc_macro_transparency = "semitransparent" ]
1520
1519
#[ allow_internal_unstable( raw_ref_op) ]
1521
- pub macro raw_const ( $e : expr) {
1522
- & raw const $e
1520
+ pub macro addr_of ( $place : expr) {
1521
+ & raw const $place
1523
1522
}
1524
1523
1525
1524
/// Create a `mut` raw pointer to a place, without creating an intermediate reference.
@@ -1534,7 +1533,6 @@ pub macro raw_const($e:expr) {
1534
1533
/// # Example
1535
1534
///
1536
1535
/// ```
1537
- /// #![feature(raw_ref_macros)]
1538
1536
/// use std::ptr;
1539
1537
///
1540
1538
/// #[repr(packed)]
@@ -1545,13 +1543,13 @@ pub macro raw_const($e:expr) {
1545
1543
///
1546
1544
/// let mut packed = Packed { f1: 1, f2: 2 };
1547
1545
/// // `&mut packed.f2` would create an unaligned reference, and thus be Undefined Behavior!
1548
- /// let raw_f2 = ptr::raw_mut !(packed.f2);
1546
+ /// let raw_f2 = ptr::addr_of_mut !(packed.f2);
1549
1547
/// unsafe { raw_f2.write_unaligned(42); }
1550
1548
/// assert_eq!({packed.f2}, 42); // `{...}` forces copying the field instead of creating a reference.
1551
1549
/// ```
1552
- #[ unstable ( feature = "raw_ref_macros" , issue = "73394 " ) ]
1550
+ #[ stable ( feature = "raw_ref_macros" , since = "1.51.0 " ) ]
1553
1551
#[ rustc_macro_transparency = "semitransparent" ]
1554
1552
#[ allow_internal_unstable( raw_ref_op) ]
1555
- pub macro raw_mut ( $e : expr) {
1556
- & raw mut $e
1553
+ pub macro addr_of_mut ( $place : expr) {
1554
+ & raw mut $place
1557
1555
}
0 commit comments