Skip to content

Use &raw [mut] place instead of addr_of[_mut]!(place) #1148

Open

Description

@BennoLossin

Since Rust 1.82.0, the raw_ref_op feature is stable. This means that in order to get a raw pointer to a place, one can write &raw place instead of having to use addr_of!(place).

A patch series addressing this issue should:

  • rewrite any usage of the addr_of[_mut]! macros to use the raw ref operators instead.
  • enable the raw_ref_op feature. The reason for this is that the kernel currently has a minimum Rust version of 1.78.0. So older compilers will need to have it enabled. Since it already is stable in a newer version this is OK.
  • add these macros to the disallowed-macros list in .clippy.toml to prevent further introductions of that macro.

This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

Activity

  1. added
    mediumExpected to be an issue of medium difficulty to resolve.
    • libRelated to the `rust/` library.
    on Mar 12, 2025
  2. antonio-hickey commented on Mar 12, 2025

    @antonio-hickey

    I'd like to take this one one on

  3. added a commit that references this issue on Apr 29, 2025
  4. added a commit that references this issue on May 26, 2025
  5. 3 remaining items

  6. added a commit that references this issue on Mar 1, 2026
  7. added a commit that references this issue on Mar 20, 2026
  8. asdfkwang commented on Oct 13, 2026

    @asdfkwang

    Hi @antonio-hickey,
    I noticed that this issue is still open and that some addr_of! / addr_of_mut! usages remain in the current mainline.
    It looks like the Rust KUnit changes mentioned in the earlier review have since landed.
    I'm interested in helping finish the remaining conversions. Are you still working on this series, or would it be okay for me to pick up the remaining work?
    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

good first issueGood for newcomersmediumExpected to be an issue of medium difficulty to resolve.• libRelated to the `rust/` library.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions