Skip to content

Commit e1dfaa3

Browse files
antonio-hickeyojeda
authored andcommitted
rust: enable raw_ref_op feature
Since Rust 1.82.0 the `raw_ref_op` feature is stable [1]. 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. Allowing us to reduce macro complexity, and improve consistency with existing reference syntax as `&raw const`, `&raw mut` are similar to `&`, `&mut` making it fit more naturally with other existing code. Suggested-by: Benno Lossin <[email protected]> Link: Rust-for-Linux#1148 Link: https://blog.rust-lang.org/2024/10/17/Rust-1.82.0.html#native-syntax-for-creating-a-raw-pointer [1] Signed-off-by: Antonio Hickey <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Tamir Duberstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Removed dashed line change as discussed. Added Link to the explanation of the feature in the Rust 1.82.0 release blog post. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 4e72a62 commit e1dfaa3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

rust/kernel/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#![cfg_attr(not(CONFIG_RUSTC_HAS_COERCE_POINTEE), feature(unsize))]
2020
#![feature(inline_const)]
2121
#![feature(lint_reasons)]
22+
// Stable in Rust 1.82
23+
#![feature(raw_ref_op)]
2224
// Stable in Rust 1.83
2325
#![feature(const_maybe_uninit_as_mut_ptr)]
2426
#![feature(const_mut_refs)]

scripts/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ $(obj)/%.lst: $(obj)/%.c FORCE
226226
# Compile Rust sources (.rs)
227227
# ---------------------------------------------------------------------------
228228

229-
rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons
229+
rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op
230230

231231
# `--out-dir` is required to avoid temporaries being created by `rustc` in the
232232
# current working directory, which may be not accessible in the out-of-tree

0 commit comments

Comments
 (0)