* [PATCH v5 01/17] rust: enable `raw_ref_op` feature [not found] <20250320020740.1631171-1-contact@antoniohickey.com> @ 2025-03-20 2:07 ` Antonio Hickey 2025-03-20 7:32 ` Andreas Hindborg 2025-03-22 10:16 ` Benno Lossin 0 siblings, 2 replies; 9+ messages in thread From: Antonio Hickey @ 2025-03-20 2:07 UTC (permalink / raw) To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Masahiro Yamada, Nathan Chancellor, Nicolas Schier Cc: Antonio Hickey, rust-for-linux, linux-kernel, linux-kbuild 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. 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 <benno.lossin@proton.me> Link: https://github.com/Rust-for-Linux/linux/issues/1148 Signed-off-by: Antonio Hickey <contact@antoniohickey.com> --- rust/kernel/lib.rs | 2 ++ scripts/Makefile.build | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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)] diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 993708d11874..a73aaa028e34 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE $(call if_changed_dep,cc_lst_c) # Compile Rust sources (.rs) -# --------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------- -rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons +rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op # `--out-dir` is required to avoid temporaries being created by `rustc` in the # current working directory, which may be not accessible in the out-of-tree ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-20 2:07 ` [PATCH v5 01/17] rust: enable `raw_ref_op` feature Antonio Hickey @ 2025-03-20 7:32 ` Andreas Hindborg 2025-03-22 10:16 ` Benno Lossin 1 sibling, 0 replies; 9+ messages in thread From: Andreas Hindborg @ 2025-03-20 7:32 UTC (permalink / raw) To: Antonio Hickey Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross, Danilo Krummrich, Masahiro Yamada, Nathan Chancellor, Nicolas Schier, rust-for-linux, linux-kernel, linux-kbuild "Antonio Hickey" <contact@antoniohickey.com> writes: > 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. > > 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 <benno.lossin@proton.me> > Link: https://github.com/Rust-for-Linux/linux/issues/1148 > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Best regards, Andreas Hindborg ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-20 2:07 ` [PATCH v5 01/17] rust: enable `raw_ref_op` feature Antonio Hickey 2025-03-20 7:32 ` Andreas Hindborg @ 2025-03-22 10:16 ` Benno Lossin 2025-03-22 15:02 ` Antonio Hickey 1 sibling, 1 reply; 9+ messages in thread From: Benno Lossin @ 2025-03-22 10:16 UTC (permalink / raw) To: Antonio Hickey, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Masahiro Yamada, Nathan Chancellor, Nicolas Schier Cc: rust-for-linux, linux-kernel, linux-kbuild On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote: > 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. > > 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 <benno.lossin@proton.me> > Link: https://github.com/Rust-for-Linux/linux/issues/1148 > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 993708d11874..a73aaa028e34 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE > $(call if_changed_dep,cc_lst_c) > > # Compile Rust sources (.rs) > -# --------------------------------------------------------------------------- > +# -------------------------------------------------------------------------------------- Not sure about this change. --- Cheers, Benno > > -rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons > +rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op > > # `--out-dir` is required to avoid temporaries being created by `rustc` in the > # current working directory, which may be not accessible in the out-of-tree ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 10:16 ` Benno Lossin @ 2025-03-22 15:02 ` Antonio Hickey 2025-03-22 18:24 ` Tamir Duberstein 0 siblings, 1 reply; 9+ messages in thread From: Antonio Hickey @ 2025-03-22 15:02 UTC (permalink / raw) To: benno.lossin Cc: a.hindborg, alex.gaynor, aliceryhl, bjorn3_gh, boqun.feng, contact, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tmgross On Sat, Mar 22, 2025 at 10:16:01AM +0000, Benno Lossin wrote: > On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote: > > 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. > > > > 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 <benno.lossin@proton.me> > > Link: https://github.com/Rust-for-Linux/linux/issues/1148 > > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> > > Reviewed-by: Benno Lossin <benno.lossin@proton.me> > > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > > index 993708d11874..a73aaa028e34 100644 > > --- a/scripts/Makefile.build > > +++ b/scripts/Makefile.build > > @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE > > $(call if_changed_dep,cc_lst_c) > > > > # Compile Rust sources (.rs) > > -# --------------------------------------------------------------------------- > > +# -------------------------------------------------------------------------------------- > > Not sure about this change. This change is so I could enable the `raw_ref_op` feature for doctests since the minimum Rust version 1.78 still has `raw_ref_op` as an expiramental feature, and will throw errors at compile if a doctest uses it. Is there a better way to do this? Thanks, Antonio > > --- > Cheers, > Benno > > > > > -rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons > > +rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op > > > > # `--out-dir` is required to avoid temporaries being created by `rustc` in the > > # current working directory, which may be not accessible in the out-of-tree > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 15:02 ` Antonio Hickey @ 2025-03-22 18:24 ` Tamir Duberstein 2025-03-22 19:12 ` Antonio Hickey 0 siblings, 1 reply; 9+ messages in thread From: Tamir Duberstein @ 2025-03-22 18:24 UTC (permalink / raw) To: Antonio Hickey Cc: benno.lossin, a.hindborg, alex.gaynor, aliceryhl, bjorn3_gh, boqun.feng, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tmgross On Sat, Mar 22, 2025 at 11:08 AM Antonio Hickey <contact@antoniohickey.com> wrote: > > On Sat, Mar 22, 2025 at 10:16:01AM +0000, Benno Lossin wrote: > > On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote: > > > 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. > > > > > > 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 <benno.lossin@proton.me> > > > Link: https://github.com/Rust-for-Linux/linux/issues/1148 > > > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> > > > > Reviewed-by: Benno Lossin <benno.lossin@proton.me> > > > > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > > > index 993708d11874..a73aaa028e34 100644 > > > --- a/scripts/Makefile.build > > > +++ b/scripts/Makefile.build > > > @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE > > > $(call if_changed_dep,cc_lst_c) > > > > > > # Compile Rust sources (.rs) > > > -# --------------------------------------------------------------------------- > > > +# -------------------------------------------------------------------------------------- > > > > Not sure about this change. > > This change is so I could enable the `raw_ref_op` feature for doctests > since the minimum Rust version 1.78 still has `raw_ref_op` as an > expiramental feature, and will throw errors at compile if a doctest uses > it. Is there a better way to do this? I think Benno is just asking about the extension of the dashed line. > > > > > > -rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons > > > +rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op This looks correct to me. > > > > > > # `--out-dir` is required to avoid temporaries being created by `rustc` in the > > > # current working directory, which may be not accessible in the out-of-tree > > > > Reviewed-by: Tamir Duberstein <tamird@gmail.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 18:24 ` Tamir Duberstein @ 2025-03-22 19:12 ` Antonio Hickey 2025-03-22 19:39 ` Benno Lossin 2025-03-22 19:41 ` Miguel Ojeda 0 siblings, 2 replies; 9+ messages in thread From: Antonio Hickey @ 2025-03-22 19:12 UTC (permalink / raw) To: tamird Cc: a.hindborg, alex.gaynor, aliceryhl, benno.lossin, bjorn3_gh, boqun.feng, contact, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tmgross On Sat, Mar 22, 2025 at 02:24:30PM -0400, Tamir Duberstein wrote: > On Sat, Mar 22, 2025 at 11:08 AM Antonio Hickey > <contact@antoniohickey.com> wrote: > > > > On Sat, Mar 22, 2025 at 10:16:01AM +0000, Benno Lossin wrote: > > > On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote: > > > > 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. > > > > > > > > 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 <benno.lossin@proton.me> > > > > Link: https://github.com/Rust-for-Linux/linux/issues/1148 > > > > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> > > > > > > Reviewed-by: Benno Lossin <benno.lossin@proton.me> > > > > > > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > > > > index 993708d11874..a73aaa028e34 100644 > > > > --- a/scripts/Makefile.build > > > > +++ b/scripts/Makefile.build > > > > @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE > > > > $(call if_changed_dep,cc_lst_c) > > > > > > > > # Compile Rust sources (.rs) > > > > -# --------------------------------------------------------------------------- > > > > +# -------------------------------------------------------------------------------------- > > > > > > Not sure about this change. > > > > This change is so I could enable the `raw_ref_op` feature for doctests > > since the minimum Rust version 1.78 still has `raw_ref_op` as an > > expiramental feature, and will throw errors at compile if a doctest uses > > it. Is there a better way to do this? > > I think Benno is just asking about the extension of the dashed line. Ahh ok yea that makes sense, thanks Tamir, sorry Benno I misunderstood. So the reason I extended the dashed line was because before my change the dashed line perfectly aligned with number of characters in the line I changed. I figured it was supposed to match the amount of characters of the line. Giving this a deeper look it looks like the all the other dashed lines are maxed at 77 characters. I will update this. Thanks, Antonio > > > > > > > > > -rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons > > > > +rust_allowed_features := asm_const,asm_goto,arbitrary_self_types,lint_reasons,raw_ref_op > > This looks correct to me. > > > > > > > > > # `--out-dir` is required to avoid temporaries being created by `rustc` in the > > > > # current working directory, which may be not accessible in the out-of-tree > > > > > > > > Reviewed-by: Tamir Duberstein <tamird@gmail.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 19:12 ` Antonio Hickey @ 2025-03-22 19:39 ` Benno Lossin 2025-03-22 19:41 ` Miguel Ojeda 1 sibling, 0 replies; 9+ messages in thread From: Benno Lossin @ 2025-03-22 19:39 UTC (permalink / raw) To: Antonio Hickey, tamird Cc: a.hindborg, alex.gaynor, aliceryhl, bjorn3_gh, boqun.feng, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tmgross On Sat Mar 22, 2025 at 8:12 PM CET, Antonio Hickey wrote: > On Sat, Mar 22, 2025 at 02:24:30PM -0400, Tamir Duberstein wrote: >> On Sat, Mar 22, 2025 at 11:08 AM Antonio Hickey >> <contact@antoniohickey.com> wrote: >> > On Sat, Mar 22, 2025 at 10:16:01AM +0000, Benno Lossin wrote: >> > > On Thu Mar 20, 2025 at 3:07 AM CET, Antonio Hickey wrote: >> > > > 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. >> > > > >> > > > 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 <benno.lossin@proton.me> >> > > > Link: https://github.com/Rust-for-Linux/linux/issues/1148 >> > > > Signed-off-by: Antonio Hickey <contact@antoniohickey.com> >> > > >> > > Reviewed-by: Benno Lossin <benno.lossin@proton.me> >> > > >> > > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build >> > > > index 993708d11874..a73aaa028e34 100644 >> > > > --- a/scripts/Makefile.build >> > > > +++ b/scripts/Makefile.build >> > > > @@ -224,9 +224,9 @@ $(obj)/%.lst: $(obj)/%.c FORCE >> > > > $(call if_changed_dep,cc_lst_c) >> > > > >> > > > # Compile Rust sources (.rs) >> > > > -# --------------------------------------------------------------------------- >> > > > +# -------------------------------------------------------------------------------------- >> > > >> > > Not sure about this change. >> > >> > This change is so I could enable the `raw_ref_op` feature for doctests >> > since the minimum Rust version 1.78 still has `raw_ref_op` as an >> > expiramental feature, and will throw errors at compile if a doctest uses >> > it. Is there a better way to do this? >> >> I think Benno is just asking about the extension of the dashed line. > > Ahh ok yea that makes sense, thanks Tamir, sorry Benno I misunderstood. No worries, it is exactly as Tamir said. > So the reason I extended the dashed line was because before my change > the dashed line perfectly aligned with number of characters in the line > I changed. I figured it was supposed to match the amount of characters > of the line. > > Giving this a deeper look it looks like the all the other dashed lines > are maxed at 77 characters. Yeah that's also what I thought, so I wouldn't change it. > I will update this. If you send another version, you can update this, but Miguel might pick the patch early, he can then remove the change above when taking the patch (so I wouldn't send a new version just to change this single line). --- Cheers, Benno ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 19:12 ` Antonio Hickey 2025-03-22 19:39 ` Benno Lossin @ 2025-03-22 19:41 ` Miguel Ojeda 2025-03-22 20:12 ` Antonio Hickey 1 sibling, 1 reply; 9+ messages in thread From: Miguel Ojeda @ 2025-03-22 19:41 UTC (permalink / raw) To: Antonio Hickey Cc: tamird, a.hindborg, alex.gaynor, aliceryhl, benno.lossin, bjorn3_gh, boqun.feng, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tmgross On Sat, Mar 22, 2025 at 8:12 PM Antonio Hickey <contact@antoniohickey.com> wrote: > > Ahh ok yea that makes sense, thanks Tamir, sorry Benno I misunderstood. > > So the reason I extended the dashed line was because before my change > the dashed line perfectly aligned with number of characters in the line > I changed. I figured it was supposed to match the amount of characters > of the line. > > Giving this a deeper look it looks like the all the other dashed lines > are maxed at 77 characters. Yeah, it is just following other section "lines". > I will update this. Benno is right -- no need to send another version for that, I can remove the change on apply. :) Thanks! Cheers, Miguel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 01/17] rust: enable `raw_ref_op` feature 2025-03-22 19:41 ` Miguel Ojeda @ 2025-03-22 20:12 ` Antonio Hickey 0 siblings, 0 replies; 9+ messages in thread From: Antonio Hickey @ 2025-03-22 20:12 UTC (permalink / raw) To: miguel.ojeda.sandonis Cc: a.hindborg, alex.gaynor, aliceryhl, benno.lossin, bjorn3_gh, boqun.feng, contact, dakr, gary, linux-kbuild, linux-kernel, masahiroy, nathan, nicolas, ojeda, rust-for-linux, tamird, tmgross On Sat, Mar 22, 2025 at 08:41:11PM +0100, Miguel Ojeda wrote: > On Sat, Mar 22, 2025 at 8:12 PM Antonio Hickey > <contact@antoniohickey.com> wrote: > > > > Ahh ok yea that makes sense, thanks Tamir, sorry Benno I misunderstood. > > > > So the reason I extended the dashed line was because before my change > > the dashed line perfectly aligned with number of characters in the line > > I changed. I figured it was supposed to match the amount of characters > > of the line. > > > > Giving this a deeper look it looks like the all the other dashed lines > > are maxed at 77 characters. > > Yeah, it is just following other section "lines". > > > I will update this. > > Benno is right -- no need to send another version for that, I can > remove the change on apply. :) Yay my first patch to be applied :) Hopefully many more to come, thanks a lot everyone I have learned so much just through this simple patch series. Appreciate all the help and patience +1 Thanks, Antonio > > Thanks! > > Cheers, > Miguel ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-03-22 20:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250320020740.1631171-1-contact@antoniohickey.com>
2025-03-20 2:07 ` [PATCH v5 01/17] rust: enable `raw_ref_op` feature Antonio Hickey
2025-03-20 7:32 ` Andreas Hindborg
2025-03-22 10:16 ` Benno Lossin
2025-03-22 15:02 ` Antonio Hickey
2025-03-22 18:24 ` Tamir Duberstein
2025-03-22 19:12 ` Antonio Hickey
2025-03-22 19:39 ` Benno Lossin
2025-03-22 19:41 ` Miguel Ojeda
2025-03-22 20:12 ` Antonio Hickey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox