From: Antonio Hickey <contact@antoniohickey.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>
Cc: Antonio Hickey <contact@antoniohickey.com>,
rust-for-linux@vger.kernel.org
Subject: [PATCH v6 00/18] refactor to utilize `&raw [const|mut]`
Date: Thu, 17 Apr 2025 21:41:21 -0400 [thread overview]
Message-ID: <20250418014143.888022-1-contact@antoniohickey.com> (raw)
This patch set enables the `raw_ref_op` feature, which became stable
in Rust 1.82.
It then replaces all occurences of `addr_of!(place)` and
`addr_of_mut!(place)` with `&raw const place` and `&raw mut place`.
Finally it adds the previous macros `addr_of!` and `addr_of_mut!` to
the disallowed macros in `.clippy.toml`.
Changes in v6:
- Rebased onto rust-next to refactor new occurences of `addr_of[_mut]!`
and handle the 2 patches from the v5 patchset that were merged.
- Link to v5: https://lore.kernel.org/all/20250320020740.1631171-1-contact@antoniohickey.com/
Changes in v5:
- Fix doctest errors when compiling on the minimum Rust version (1.78)
due to not having the `raw_ref_op` feature enabled for doctests.
- Reword commit messages to more accurately describe the changes.
- Replace unsafe call to `Opaque::raw_get` with pointer casting
in workqueue.
- Fix clippy disallowed macros message for `core::ptr::addr_of`
- Link to v4: https://lore.kernel.org/all/20250316061429.817126-1-contact@antoniohickey.com/
Changes in v4:
- Fix comment typo.
- Fix clippy issues.
- Add more context and link for disallowed macros with clippy.
- Separate the patch replacing of `addr_of[_mut]!` macros with
`&raw [const|mut]` into smaller patches for each section.
(PATCH v3 2/3 -> PATCH v4 2/16 through 15/16)
- Fix email typo.
- Link to v3: https://lore.kernel.org/all/0100019597091f92-cb55b6cd-4d06-4d14-8d9c-1a1314949a00-000000@email.amazonses.com/
Changes in v3:
- Re ordered the patches, so that the patch adding the `addr_of[_mut]!`
macros to the disallowed macros in clippy is applied after replacing
all the instances of `addr_of_[_mut]` with `&raw [const|mut]`.
(moved PATCH v2 2/3 -> PATCH v3 3/3 and PATCH v2 3/3 -> PATCH v3 2/3)
- Link to v2: https://lore.kernel.org/all/0100019592c224ba-0cf38e16-2aa2-459d-99cd-09a463d616d4-000000@email.amazonses.com/
Changes in v2:
- Fix `&raw place` should be `&raw const place`
- Fix email typo
- Link to v1: https://lore.kernel.org/all/010001958dfeacb5-9039aaab-6114-494a-9f1d-f13982091169-000000@email.amazonses.com/
Suggested-by: Benno Lossin <benno.lossin@proton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
Antonio Hickey (18):
rust: init: refactor to use `&raw mut`
rust: list: refactor to use `&raw [const|mut]`
rust: task: remove use of `addr_of!` macro
rust: faux: refactor to use `&raw mut`
rust: kunit: refactor to use `&raw [const|mut]`
rust: workqueue: refactor to use `&raw [const|mut]`
rust: workqueue: replace `raw_get` with pointer cast
rust: rbtree: refactor to use `&raw mut`
rust: net: phy: refactor to use `&raw mut`
rust: sync: arc: refactor to use `&raw const`
rust: jump_label: refactor to use `&raw const`
rust: fs: file: refactor to use `&raw const`
rust: time: hrtimer: refactor to use `&raw const`
rust: pci: refactor to use `&raw mut`
rust: platform: refactor to use `&raw mut`
rust: dma: refactor to use `&raw [const|mut]`
rust: pin-init: refactor to use `&raw mut`
rust: clippy: disallow `addr_of[_mut]!` macros
.clippy.toml | 4 ++++
rust/kernel/dma.rs | 4 ++--
rust/kernel/faux.rs | 4 ++--
rust/kernel/fs/file.rs | 2 +-
rust/kernel/init.rs | 4 ++--
rust/kernel/jump_label.rs | 4 ++--
rust/kernel/kunit.rs | 8 ++++----
rust/kernel/list.rs | 2 +-
rust/kernel/list/impl_list_item_mod.rs | 6 +++---
rust/kernel/net/phy.rs | 4 ++--
rust/kernel/pci.rs | 8 ++------
rust/kernel/platform.rs | 8 ++------
rust/kernel/rbtree.rs | 22 ++++++++++----------
rust/kernel/sync/arc.rs | 4 ++--
rust/kernel/task.rs | 4 ++--
rust/kernel/time/hrtimer.rs | 4 ++--
rust/kernel/workqueue.rs | 9 +++------
rust/pin-init/README.md | 3 +--
rust/pin-init/src/lib.rs | 7 +++----
rust/pin-init/src/macros.rs | 28 +++++++++++++-------------
20 files changed, 65 insertions(+), 74 deletions(-)
next reply other threads:[~2025-04-18 1:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 1:41 Antonio Hickey [this message]
2025-04-18 1:41 ` [PATCH v6 01/18] rust: init: refactor to use `&raw mut` Antonio Hickey
2025-04-21 20:20 ` Benno Lossin
2025-04-18 1:41 ` [PATCH v6 02/18] rust: list: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 03/18] rust: task: remove use of `addr_of!` macro Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 04/18] rust: faux: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 05/18] rust: kunit: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 06/18] rust: workqueue: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 07/18] rust: workqueue: replace `raw_get` with pointer cast Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 08/18] rust: rbtree: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 09/18] rust: net: phy: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 10/18] rust: sync: arc: refactor to use `&raw const` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 11/18] rust: jump_label: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 12/18] rust: fs: file: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 13/18] rust: time: hrtimer: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 14/18] rust: pci: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 15/18] rust: platform: " Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 17/18] rust: pin-init: refactor to use `&raw mut` Antonio Hickey
2025-04-18 1:41 ` [PATCH v6 18/18] rust: clippy: disallow `addr_of[_mut]!` macros Antonio Hickey
2025-04-18 13:45 ` [PATCH v6 00/18] refactor to utilize `&raw [const|mut]` Miguel Ojeda
2025-09-08 11:23 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250418014143.888022-1-contact@antoniohickey.com \
--to=contact@antoniohickey.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.