Re: [PATCH v3 2/3] rust: replace `addr_of[_mut]!` with `&raw [mut]`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 14, 2025 at 11:41:55PM +0000, Antonio Hickey wrote:
[...]
> @@ -541,7 +541,7 @@ macro_rules! stack_try_pin_init {
>  ///
>  /// ```rust
>  /// # use kernel::{macros::{Zeroable, pin_data}, pin_init};
> -/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
> +/// # use core::marker::PhantomPinned;
>  /// #[pin_data]
>  /// #[derive(Zeroable)]
>  /// struct Buf {
> @@ -554,7 +554,7 @@ macro_rules! stack_try_pin_init {
>  /// pin_init!(&this in Buf {
>  ///     buf: [0; 64],
>  ///     // SAFETY: TODO.
> -///     ptr: unsafe { addr_of_mut!((*this.as_ptr()).buf).cast() },
> +///     ptr: unsafe { &raw mut (*this.as_ptr()).buf.cast() },

This should be:


///     ptr: unsafe { &raw mut ((*this.as_ptr()).buf).cast() },

, right?

Regards,
Boqun

>  ///     pin: PhantomPinned,
>  /// });
>  /// pin_init!(Buf {
[...]




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux