[PATCH v2 1/3] rust: enable `raw_ref_op` feature
From: Antonio Hickey
Date: Thu Mar 13 2025 - 23:46:13 EST
Since Rust 1.82.0 the `raw_ref_op` feature is stable.
By enabling this feature we can use `&raw const place` and `&raw mut place`
instead of using `addr_of!(place)` and `addr_of_mut!(place)` macros.
This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` is very similar to
`&`, `&mut` making it fit more naturally with other existing code than
the previously used macros.
Suggested-by: Benno Lossin <benno.lossin@xxxxxxxxx>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@xxxxxxxxxxxxxxxxx>
---
rust/kernel/lib.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 398242f92a96..1d078f69bb19 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -19,6 +19,8 @@
#![cfg_attr(not(CONFIG_RUSTC_HAS_COERCE_POINTEE), feature(unsize))]
#![feature(inline_const)]
#![feature(lint_reasons)]
+// Stable in Rust 1.82
+#![feature(raw_ref_op)]
// Stable in Rust 1.83
#![feature(const_maybe_uninit_as_mut_ptr)]
#![feature(const_mut_refs)]
--
2.48.1