244244//! struct __InitOk;
245245//! // This is the expansion of `t,`, which is syntactic sugar for `t: t,`.
246246//! {
247- //! unsafe { ::core::ptr::write(::core::addr_of_mut!(( *slot).t) , t) };
247+ //! unsafe { ::core::ptr::write(&raw mut ( *slot).t, t) };
248248//! }
249249//! // Since initialization could fail later (not in this case, since the
250250//! // error type is `Infallible`) we will need to drop this field if there
251251//! // is an error later. This `DropGuard` will drop the field when it gets
252252//! // dropped and has not yet been forgotten.
253253//! let __t_guard = unsafe {
254- //! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!(( *slot).t) )
254+ //! ::pin_init::__internal::DropGuard::new(&raw mut ( *slot).t)
255255//! };
256256//! // Expansion of `x: 0,`:
257257//! // Since this can be an arbitrary expression we cannot place it inside
258258//! // of the `unsafe` block, so we bind it here.
259259//! {
260260//! let x = 0;
261- //! unsafe { ::core::ptr::write(::core::addr_of_mut!(( *slot).x) , x) };
261+ //! unsafe { ::core::ptr::write(&raw mut ( *slot).x, x) };
262262//! }
263263//! // We again create a `DropGuard`.
264264//! let __x_guard = unsafe {
265- //! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!(( *slot).x) )
265+ //! ::pin_init::__internal::DropGuard::new(&raw mut ( *slot).x)
266266//! };
267267//! // Since initialization has successfully completed, we can now forget
268268//! // the guards. This is not `mem::forget`, since we only have
459459//! {
460460//! struct __InitOk;
461461//! {
462- //! unsafe { ::core::ptr::write(::core::addr_of_mut!(( *slot).a) , a) };
462+ //! unsafe { ::core::ptr::write(&raw mut ( *slot).a, a) };
463463//! }
464464//! let __a_guard = unsafe {
465- //! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!(( *slot).a) )
465+ //! ::pin_init::__internal::DropGuard::new(&raw mut ( *slot).a)
466466//! };
467467//! let init = Bar::new(36);
468- //! unsafe { data.b(::core::addr_of_mut!(( *slot).b) , b)? };
468+ //! unsafe { data.b(&raw mut ( *slot).b, b)? };
469469//! let __b_guard = unsafe {
470- //! ::pin_init::__internal::DropGuard::new(::core::addr_of_mut!(( *slot).b) )
470+ //! ::pin_init::__internal::DropGuard::new(&raw mut ( *slot).b)
471471//! };
472472//! ::core::mem::forget(__b_guard);
473473//! ::core::mem::forget(__a_guard);
@@ -1215,15 +1215,15 @@ macro_rules! __init_internal {
12151215 // SAFETY: `slot` is valid, because we are inside of an initializer closure, we
12161216 // return when an error/panic occurs.
12171217 // We also use the `data` to require the correct trait (`Init` or `PinInit`) for `$field`.
1218- unsafe { $data. $field( :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) , init) ? } ;
1218+ unsafe { $data. $field( & raw mut ( * $slot) . $field, init) ? } ;
12191219 // Create the drop guard:
12201220 //
12211221 // We rely on macro hygiene to make it impossible for users to access this local variable.
12221222 // We use `paste!` to create new hygiene for `$field`.
12231223 $crate:: macros:: paste! {
12241224 // SAFETY: We forget the guard later when initialization has succeeded.
12251225 let [ < __ $field _guard >] = unsafe {
1226- $crate:: __internal:: DropGuard :: new( :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) )
1226+ $crate:: __internal:: DropGuard :: new( & raw mut ( * $slot) . $field)
12271227 } ;
12281228
12291229 $crate:: __init_internal!( init_slot( $use_data) :
@@ -1246,15 +1246,15 @@ macro_rules! __init_internal {
12461246 //
12471247 // SAFETY: `slot` is valid, because we are inside of an initializer closure, we
12481248 // return when an error/panic occurs.
1249- unsafe { $crate:: Init :: __init( init, :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) ) ? } ;
1249+ unsafe { $crate:: Init :: __init( init, & raw mut ( * $slot) . $field) ? } ;
12501250 // Create the drop guard:
12511251 //
12521252 // We rely on macro hygiene to make it impossible for users to access this local variable.
12531253 // We use `paste!` to create new hygiene for `$field`.
12541254 $crate:: macros:: paste! {
12551255 // SAFETY: We forget the guard later when initialization has succeeded.
12561256 let [ < __ $field _guard >] = unsafe {
1257- $crate:: __internal:: DropGuard :: new( :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) )
1257+ $crate:: __internal:: DropGuard :: new( & raw mut ( * $slot) . $field)
12581258 } ;
12591259
12601260 $crate:: __init_internal!( init_slot( ) :
@@ -1277,7 +1277,7 @@ macro_rules! __init_internal {
12771277 // Initialize the field.
12781278 //
12791279 // SAFETY: The memory at `slot` is uninitialized.
1280- unsafe { :: core:: ptr:: write( :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) , $field) } ;
1280+ unsafe { :: core:: ptr:: write( & raw mut ( * $slot) . $field, $field) } ;
12811281 }
12821282 // Create the drop guard:
12831283 //
@@ -1286,7 +1286,7 @@ macro_rules! __init_internal {
12861286 $crate:: macros:: paste! {
12871287 // SAFETY: We forget the guard later when initialization has succeeded.
12881288 let [ < __ $field _guard >] = unsafe {
1289- $crate:: __internal:: DropGuard :: new( :: core :: ptr :: addr_of_mut! ( ( * $slot) . $field) )
1289+ $crate:: __internal:: DropGuard :: new( & raw mut ( * $slot) . $field)
12901290 } ;
12911291
12921292 $crate:: __init_internal!( init_slot( $( $use_data) ?) :
0 commit comments