* [PATCH 1/5] rust: pin-init: build: simplify use of nightly features
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
@ 2026-03-19 9:35 ` Benno Lossin
2026-03-19 9:35 ` [PATCH 2/5] rust: pin-init: properly document let binding workaround Benno Lossin
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:35 UTC (permalink / raw)
To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Christian Schrefl,
Tamir Duberstein, Oleksandr Babak
Cc: rust-for-linux, linux-kernel
From: Gary Guo <gary@garyguo.net>
We use some features that are already stable in later versions of Rust,
but only available as unstable features in older Rust versions that the
kernel needs to support.
Instead of checking if a feature is already stable, simply enable them
and allow the warning if the feature is already stable. This avoids the
need of hardcoding whether a feature has been stabilized at a given
version.
`#[feature(...)]` is used when cfg `USE_RUSTC_FEATURES` is enabled. The
build script automatically does this when a nightly compiler is detected
or `RUSTC_BOOTSTRAP` is set.
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://github.com/Rust-for-Linux/pin-init/commit/885c5d83d7eb778a796d4a17380a0898b0d0a571
[ Added kernel build system changes to always enable USE_RUSTC_FEATURES.
Moved this commit earlier (swapped with the next one) to avoid a build
error. - Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
rust/Makefile | 4 ++--
rust/pin-init/examples/linked_list.rs | 2 +-
rust/pin-init/examples/mutex.rs | 2 +-
rust/pin-init/examples/pthread_mutex.rs | 2 +-
rust/pin-init/examples/static_init.rs | 2 +-
rust/pin-init/internal/src/lib.rs | 2 +-
rust/pin-init/src/lib.rs | 7 ++-----
7 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/rust/Makefile b/rust/Makefile
index 9801af2e1e02..e92daeb3542b 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -118,7 +118,7 @@ syn-flags := \
$(call cfgs-to-flags,$(syn-cfgs))
pin_init_internal-cfgs := \
- kernel
+ kernel USE_RUSTC_FEATURES
pin_init_internal-flags := \
--extern proc_macro2 \
@@ -127,7 +127,7 @@ pin_init_internal-flags := \
$(call cfgs-to-flags,$(pin_init_internal-cfgs))
pin_init-cfgs := \
- kernel
+ kernel USE_RUSTC_FEATURES
pin_init-flags := \
--extern pin_init_internal \
diff --git a/rust/pin-init/examples/linked_list.rs b/rust/pin-init/examples/linked_list.rs
index 8445a5890cb7..226e33e4a957 100644
--- a/rust/pin-init/examples/linked_list.rs
+++ b/rust/pin-init/examples/linked_list.rs
@@ -2,7 +2,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
use core::{
cell::Cell,
diff --git a/rust/pin-init/examples/mutex.rs b/rust/pin-init/examples/mutex.rs
index 9f295226cd64..e534c367f644 100644
--- a/rust/pin-init/examples/mutex.rs
+++ b/rust/pin-init/examples/mutex.rs
@@ -2,7 +2,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
#![allow(clippy::missing_safety_doc)]
use core::{
diff --git a/rust/pin-init/examples/pthread_mutex.rs b/rust/pin-init/examples/pthread_mutex.rs
index 4e082ec7d5de..562ca5d3d08c 100644
--- a/rust/pin-init/examples/pthread_mutex.rs
+++ b/rust/pin-init/examples/pthread_mutex.rs
@@ -3,7 +3,7 @@
// inspired by <https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs>
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
#[cfg(not(windows))]
mod pthread_mtx {
diff --git a/rust/pin-init/examples/static_init.rs b/rust/pin-init/examples/static_init.rs
index 0e165daa9798..df562134a53c 100644
--- a/rust/pin-init/examples/static_init.rs
+++ b/rust/pin-init/examples/static_init.rs
@@ -2,7 +2,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
#![allow(unused_imports)]
use core::{
diff --git a/rust/pin-init/internal/src/lib.rs b/rust/pin-init/internal/src/lib.rs
index 08372c8f65f0..b08dfe003031 100644
--- a/rust/pin-init/internal/src/lib.rs
+++ b/rust/pin-init/internal/src/lib.rs
@@ -6,7 +6,7 @@
//! `pin-init` proc macros.
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
// Documentation is done in the pin-init crate instead.
#![allow(missing_docs)]
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index fe4c85ae3f02..b1de166b5626 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -264,12 +264,9 @@
//! [`impl Init<T, E>`]: crate::Init
//! [Rust-for-Linux]: https://rust-for-linux.com/
-#![cfg_attr(not(RUSTC_LINT_REASONS_IS_STABLE), feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
#![cfg_attr(
- all(
- any(feature = "alloc", feature = "std"),
- not(RUSTC_NEW_UNINIT_IS_STABLE)
- ),
+ all(any(feature = "alloc", feature = "std"), USE_RUSTC_FEATURES),
feature(new_uninit)
)]
#![forbid(missing_docs, unsafe_op_in_unsafe_fn)]
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 2/5] rust: pin-init: properly document let binding workaround
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
2026-03-19 9:35 ` [PATCH 1/5] rust: pin-init: build: simplify use of nightly features Benno Lossin
@ 2026-03-19 9:35 ` Benno Lossin
2026-03-19 11:04 ` Gary Guo
2026-03-19 9:35 ` [PATCH 3/5] rust: pin-init: doc: de-clutter documentation with fake-variadics Benno Lossin
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:35 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Janne Grunau, Christian Schrefl,
Oleksandr Babak
Cc: rust-for-linux, linux-kernel
The three let bindings (in the bodies of `cast_init`, `cast_pin_init`
and the `init!` macro) are used to avoid the following compiler error in
Rust 1.78.0, 1.79.0, 1.80.0, 1.80.1, and 1.81.0 (just showing the one
for `cast_init`, the others are similar):
error[E0391]: cycle detected when computing type of opaque `cast_init::{opaque#0}`
--> src/lib.rs:1160:66
|
1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
| ^^^^^^^^^^^^^^^
|
note: ...which requires borrow-checking `cast_init`...
--> src/lib.rs:1160:1
|
1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `cast_init`...
--> src/lib.rs:1160:1
|
1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires computing whether `cast_init::{opaque#0}` is freeze...
= note: ...which requires evaluating trait selection obligation `cast_init::{opaque#0}: core::marker::Freeze`...
= note: ...which again requires computing type of opaque `cast_init::{opaque#0}`, completing the cycle
note: cycle used when computing type of `cast_init::{opaque#0}`
--> src/lib.rs:1160:66
|
1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
| ^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
Once we raise the nightly-MSRV above 1.81, we can remove this
workaround.
Link: https://github.com/Rust-for-Linux/pin-init/commit/bb3e96f3e9a4f5fca80a22af883c7e5aa90f0893
[ Moved this commit after the previous one to avoid a build failure due
to unstable features. Changed the cfg to use `USE_RUSTC_FEAUTURES`.
- Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
rust/pin-init/examples/big_struct_in_place.rs | 2 ++
rust/pin-init/internal/src/init.rs | 6 ++++++
rust/pin-init/src/lib.rs | 18 ++++++++++++------
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/rust/pin-init/examples/big_struct_in_place.rs b/rust/pin-init/examples/big_struct_in_place.rs
index c05139927486..de8612a5e27d 100644
--- a/rust/pin-init/examples/big_struct_in_place.rs
+++ b/rust/pin-init/examples/big_struct_in_place.rs
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
+#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+
use pin_init::*;
// Struct with size over 1GiB
diff --git a/rust/pin-init/internal/src/init.rs b/rust/pin-init/internal/src/init.rs
index 2fe918f4d82a..c1c9400b090a 100644
--- a/rust/pin-init/internal/src/init.rs
+++ b/rust/pin-init/internal/src/init.rs
@@ -173,6 +173,12 @@ fn assert_zeroable<T: ?::core::marker::Sized>(_: *mut T)
};
// SAFETY: TODO
let init = unsafe { ::pin_init::#init_from_closure::<_, #error>(init) };
+ // FIXME: this let binding is required to avoid a compiler error (cycle when computing the
+ // opaque type returned by this function) before Rust 1.81. Remove after MSRV bump.
+ #[allow(
+ clippy::let_and_return,
+ reason = "some clippy versions warn about the let binding"
+ )]
init
}})
}
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index b1de166b5626..a513930ee01a 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -1144,9 +1144,12 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
// SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
// requirements.
let res = unsafe { pin_init_from_closure(|ptr: *mut U| init.__pinned_init(ptr.cast::<T>())) };
- // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
- // cycle when computing the type returned by this function)
- #[allow(clippy::let_and_return)]
+ // FIXME: this let binding is required to avoid a compiler error (cycle when computing the opaque
+ // type returned by this function) before Rust 1.81. Remove after MSRV bump.
+ #[allow(
+ clippy::let_and_return,
+ reason = "some clippy versions warn about the let binding"
+ )]
res
}
@@ -1160,9 +1163,12 @@ unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E> {
// SAFETY: initialization delegated to a valid initializer. Cast is valid by function safety
// requirements.
let res = unsafe { init_from_closure(|ptr: *mut U| init.__init(ptr.cast::<T>())) };
- // FIXME: remove the let statement once the nightly-MSRV allows it (1.78 otherwise encounters a
- // cycle when computing the type returned by this function)
- #[allow(clippy::let_and_return)]
+ // FIXME: this let binding is required to avoid a compiler error (cycle when computing the opaque
+ // type returned by this function) before Rust 1.81. Remove after MSRV bump.
+ #[allow(
+ clippy::let_and_return,
+ reason = "some clippy versions warn about the let binding"
+ )]
res
}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 2/5] rust: pin-init: properly document let binding workaround
2026-03-19 9:35 ` [PATCH 2/5] rust: pin-init: properly document let binding workaround Benno Lossin
@ 2026-03-19 11:04 ` Gary Guo
2026-03-19 14:44 ` Benno Lossin
0 siblings, 1 reply; 13+ messages in thread
From: Gary Guo @ 2026-03-19 11:04 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Janne Grunau, Christian Schrefl,
Oleksandr Babak
Cc: rust-for-linux, linux-kernel
On Thu Mar 19, 2026 at 9:35 AM GMT, Benno Lossin wrote:
> The three let bindings (in the bodies of `cast_init`, `cast_pin_init`
> and the `init!` macro) are used to avoid the following compiler error in
> Rust 1.78.0, 1.79.0, 1.80.0, 1.80.1, and 1.81.0 (just showing the one
> for `cast_init`, the others are similar):
>
> error[E0391]: cycle detected when computing type of opaque `cast_init::{opaque#0}`
> --> src/lib.rs:1160:66
> |
> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
> | ^^^^^^^^^^^^^^^
> |
> note: ...which requires borrow-checking `cast_init`...
> --> src/lib.rs:1160:1
> |
> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> note: ...which requires const checking `cast_init`...
> --> src/lib.rs:1160:1
> |
> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> = note: ...which requires computing whether `cast_init::{opaque#0}` is freeze...
> = note: ...which requires evaluating trait selection obligation `cast_init::{opaque#0}: core::marker::Freeze`...
> = note: ...which again requires computing type of opaque `cast_init::{opaque#0}`, completing the cycle
> note: cycle used when computing type of `cast_init::{opaque#0}`
> --> src/lib.rs:1160:66
> |
> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
> | ^^^^^^^^^^^^^^^
> = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
>
> Once we raise the nightly-MSRV above 1.81, we can remove this
> workaround.
>
> Link: https://github.com/Rust-for-Linux/pin-init/commit/bb3e96f3e9a4f5fca80a22af883c7e5aa90f0893
> [ Moved this commit after the previous one to avoid a build failure due
> to unstable features. Changed the cfg to use `USE_RUSTC_FEAUTURES`.
> - Benno ]
> Signed-off-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Perhaps we should import review approvals on GitHub as R-bs.
Best,
Gary
> ---
> rust/pin-init/examples/big_struct_in_place.rs | 2 ++
> rust/pin-init/internal/src/init.rs | 6 ++++++
> rust/pin-init/src/lib.rs | 18 ++++++++++++------
> 3 files changed, 20 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 2/5] rust: pin-init: properly document let binding workaround
2026-03-19 11:04 ` Gary Guo
@ 2026-03-19 14:44 ` Benno Lossin
2026-03-19 15:18 ` Gary Guo
0 siblings, 1 reply; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 14:44 UTC (permalink / raw)
To: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Antonio Hickey, Janne Grunau, Christian Schrefl, Oleksandr Babak
Cc: rust-for-linux, linux-kernel
On Thu Mar 19, 2026 at 12:04 PM CET, Gary Guo wrote:
> On Thu Mar 19, 2026 at 9:35 AM GMT, Benno Lossin wrote:
>> The three let bindings (in the bodies of `cast_init`, `cast_pin_init`
>> and the `init!` macro) are used to avoid the following compiler error in
>> Rust 1.78.0, 1.79.0, 1.80.0, 1.80.1, and 1.81.0 (just showing the one
>> for `cast_init`, the others are similar):
>>
>> error[E0391]: cycle detected when computing type of opaque `cast_init::{opaque#0}`
>> --> src/lib.rs:1160:66
>> |
>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>> | ^^^^^^^^^^^^^^^
>> |
>> note: ...which requires borrow-checking `cast_init`...
>> --> src/lib.rs:1160:1
>> |
>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> note: ...which requires const checking `cast_init`...
>> --> src/lib.rs:1160:1
>> |
>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> = note: ...which requires computing whether `cast_init::{opaque#0}` is freeze...
>> = note: ...which requires evaluating trait selection obligation `cast_init::{opaque#0}: core::marker::Freeze`...
>> = note: ...which again requires computing type of opaque `cast_init::{opaque#0}`, completing the cycle
>> note: cycle used when computing type of `cast_init::{opaque#0}`
>> --> src/lib.rs:1160:66
>> |
>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>> | ^^^^^^^^^^^^^^^
>> = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
>>
>> Once we raise the nightly-MSRV above 1.81, we can remove this
>> workaround.
>>
>> Link: https://github.com/Rust-for-Linux/pin-init/commit/bb3e96f3e9a4f5fca80a22af883c7e5aa90f0893
>> [ Moved this commit after the previous one to avoid a build failure due
>> to unstable features. Changed the cfg to use `USE_RUSTC_FEAUTURES`.
>> - Benno ]
>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>
> Reviewed-by: Gary Guo <gary@garyguo.net>
>
> Perhaps we should import review approvals on GitHub as R-bs.
Yeah we should. A quick internet search didn't reveal a magic tool to
me. Do you know of any?
Cheers,
Benno
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 2/5] rust: pin-init: properly document let binding workaround
2026-03-19 14:44 ` Benno Lossin
@ 2026-03-19 15:18 ` Gary Guo
0 siblings, 0 replies; 13+ messages in thread
From: Gary Guo @ 2026-03-19 15:18 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Janne Grunau, Christian Schrefl,
Oleksandr Babak
Cc: rust-for-linux, linux-kernel
On Thu Mar 19, 2026 at 2:44 PM GMT, Benno Lossin wrote:
> On Thu Mar 19, 2026 at 12:04 PM CET, Gary Guo wrote:
>> On Thu Mar 19, 2026 at 9:35 AM GMT, Benno Lossin wrote:
>>> The three let bindings (in the bodies of `cast_init`, `cast_pin_init`
>>> and the `init!` macro) are used to avoid the following compiler error in
>>> Rust 1.78.0, 1.79.0, 1.80.0, 1.80.1, and 1.81.0 (just showing the one
>>> for `cast_init`, the others are similar):
>>>
>>> error[E0391]: cycle detected when computing type of opaque `cast_init::{opaque#0}`
>>> --> src/lib.rs:1160:66
>>> |
>>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>>> | ^^^^^^^^^^^^^^^
>>> |
>>> note: ...which requires borrow-checking `cast_init`...
>>> --> src/lib.rs:1160:1
>>> |
>>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> note: ...which requires const checking `cast_init`...
>>> --> src/lib.rs:1160:1
>>> |
>>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> = note: ...which requires computing whether `cast_init::{opaque#0}` is freeze...
>>> = note: ...which requires evaluating trait selection obligation `cast_init::{opaque#0}: core::marker::Freeze`...
>>> = note: ...which again requires computing type of opaque `cast_init::{opaque#0}`, completing the cycle
>>> note: cycle used when computing type of `cast_init::{opaque#0}`
>>> --> src/lib.rs:1160:66
>>> |
>>> 1160 | pub const unsafe fn cast_init<T, U, E>(init: impl Init<T, E>) -> impl Init<U, E> {
>>> | ^^^^^^^^^^^^^^^
>>> = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
>>>
>>> Once we raise the nightly-MSRV above 1.81, we can remove this
>>> workaround.
>>>
>>> Link: https://github.com/Rust-for-Linux/pin-init/commit/bb3e96f3e9a4f5fca80a22af883c7e5aa90f0893
>>> [ Moved this commit after the previous one to avoid a build failure due
>>> to unstable features. Changed the cfg to use `USE_RUSTC_FEAUTURES`.
>>> - Benno ]
>>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>>
>> Reviewed-by: Gary Guo <gary@garyguo.net>
>>
>> Perhaps we should import review approvals on GitHub as R-bs.
>
> Yeah we should. A quick internet search didn't reveal a magic tool to
> me. Do you know of any?
One idea that I have:
* Re-target a PR to a temporary branch and merge it
* Have a GitHub action that walks through PR in staging branch and applies
tagging before putting it into the main branch.
Fighting with branch protection rule might be needed:
https://github.com/orgs/community/discussions/13836
Best,
Gary
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/5] rust: pin-init: doc: de-clutter documentation with fake-variadics
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
2026-03-19 9:35 ` [PATCH 1/5] rust: pin-init: build: simplify use of nightly features Benno Lossin
2026-03-19 9:35 ` [PATCH 2/5] rust: pin-init: properly document let binding workaround Benno Lossin
@ 2026-03-19 9:35 ` Benno Lossin
2026-03-19 9:35 ` [PATCH 4/5] rust: pin-init: implement ZeroableOption for NonZero* integer types Benno Lossin
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:35 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Christian Schrefl, Oleksandr Babak
Cc: rust-for-linux, linux-kernel
From: Gary Guo <gary@garyguo.net>
Currently the doc for `Zeroable` and `ZeroableOption` are filled with the
generated impl of tuples and fn pointers. Use the internal
"fake_variadics" feature to improve the rendered quality.
This makes use of an internal feature, however this is of minimal risk as
it's for documentation only, not activated during normal build, gated
behind `USE_RUSTC_FEATURES`, and can be removed at any time. This feature
is already used by serde and bevy to improve documentation quality.
For compilers that cannot use this feature, we still hide most generated
impls, and the existence of them are hinted by doc comments on the single
non-hidden impl.
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://github.com/Rust-for-Linux/pin-init/commit/530c4eb79a449599e219821f9397f03250cc2aa4
[ Reordered `#[doc]` attributes and safety comments to avoid errors in
older versions of clippy. - Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
rust/pin-init/src/lib.rs | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index a513930ee01a..7e79f75089df 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -276,6 +276,8 @@
all(feature = "unsafe-pinned", CONFIG_RUSTC_HAS_UNSAFE_PINNED),
feature(unsafe_pinned)
)]
+#![cfg_attr(all(USE_RUSTC_FEATURES, doc), allow(internal_features))]
+#![cfg_attr(all(USE_RUSTC_FEATURES, doc), feature(rustdoc_internals))]
use core::{
cell::UnsafeCell,
@@ -1638,8 +1640,14 @@ macro_rules! impl_zeroable {
}
macro_rules! impl_tuple_zeroable {
- ($(,)?) => {};
+ ($first:ident, $(,)?) => {
+ #[cfg_attr(all(USE_RUSTC_FEATURES, doc), doc(fake_variadic))]
+ /// Implemented for tuples up to 10 items long.
+ // SAFETY: All elements are zeroable and padding can be zero.
+ unsafe impl<$first: Zeroable> Zeroable for ($first,) {}
+ };
($first:ident, $($t:ident),* $(,)?) => {
+ #[cfg_attr(doc, doc(hidden))]
// SAFETY: All elements are zeroable and padding can be zero.
unsafe impl<$first: Zeroable, $($t: Zeroable),*> Zeroable for ($first, $($t),*) {}
impl_tuple_zeroable!($($t),* ,);
@@ -1654,7 +1662,16 @@ macro_rules! impl_fn_zeroable_option {
$(impl_fn_zeroable_option!({unsafe extern $abi} $args);)*
};
({$($prefix:tt)*} {$(,)?}) => {};
+ ({$($prefix:tt)*} {$ret:ident, $arg:ident $(,)?}) => {
+ #[cfg_attr(all(USE_RUSTC_FEATURES, doc), doc(fake_variadic))]
+ /// Implemented for function pointers with up to 20 arity.
+ // SAFETY: function pointers are part of the option layout optimization:
+ // <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
+ unsafe impl<$ret, $arg> ZeroableOption for $($prefix)* fn($arg) -> $ret {}
+ impl_fn_zeroable_option!({$($prefix)*} {$arg,});
+ };
({$($prefix:tt)*} {$ret:ident, $($rest:ident),* $(,)?}) => {
+ #[cfg_attr(doc, doc(hidden))]
// SAFETY: function pointers are part of the option layout optimization:
// <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
unsafe impl<$ret, $($rest),*> ZeroableOption for $($prefix)* fn($($rest),*) -> $ret {}
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 4/5] rust: pin-init: implement ZeroableOption for NonZero* integer types
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
` (2 preceding siblings ...)
2026-03-19 9:35 ` [PATCH 3/5] rust: pin-init: doc: de-clutter documentation with fake-variadics Benno Lossin
@ 2026-03-19 9:35 ` Benno Lossin
2026-03-19 9:35 ` [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut` Benno Lossin
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:35 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Christian Schrefl, Oleksandr Babak
Cc: Hamdan-Khan, rust-for-linux, linux-kernel
From: Hamdan-Khan <hamdankhan212@gmail.com>
Add a macro for implementing `ZeroableOption` for `NonZero*` types.
`Option<NonZero*>` now automatically implements `Zeroable` trait by
implementing `ZeroableOption` for `NonZero*` types, which serves as a
blanket impl.
Closes: https://github.com/Rust-for-Linux/pin-init/issues/95
Signed-off-by: Hamdan-Khan <hamdankhan212@gmail.com>
Link: https://github.com/Rust-for-Linux/pin-init/commit/74f772641cd9670848fa360f4ebfd20fdb40bf78
[ Fixed a typo in the commit message. - Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
rust/pin-init/src/lib.rs | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index 7e79f75089df..d09e7fe97eae 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -1615,13 +1615,6 @@ macro_rules! impl_zeroable {
// SAFETY: `T: Zeroable` and `UnsafeCell` is `repr(transparent)`.
{<T: ?Sized + Zeroable>} UnsafeCell<T>,
- // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee:
- // <https://doc.rust-lang.org/stable/std/option/index.html#representation>).
- Option<NonZeroU8>, Option<NonZeroU16>, Option<NonZeroU32>, Option<NonZeroU64>,
- Option<NonZeroU128>, Option<NonZeroUsize>,
- Option<NonZeroI8>, Option<NonZeroI16>, Option<NonZeroI32>, Option<NonZeroI64>,
- Option<NonZeroI128>, Option<NonZeroIsize>,
-
// SAFETY: `null` pointer is valid.
//
// We cannot use `T: ?Sized`, since the VTABLE pointer part of fat pointers is not allowed to be
@@ -1681,6 +1674,20 @@ unsafe impl<$ret, $($rest),*> ZeroableOption for $($prefix)* fn($($rest),*) -> $
impl_fn_zeroable_option!(["Rust", "C"] { A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U });
+macro_rules! impl_non_zero_int_zeroable_option {
+ ($($int:ty),* $(,)?) => {
+ // SAFETY: Safety comment written in the macro invocation.
+ $(unsafe impl ZeroableOption for $int {})*
+ };
+}
+
+impl_non_zero_int_zeroable_option! {
+ // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee:
+ // <https://doc.rust-lang.org/stable/std/option/index.html#representation>).
+ NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize,
+ NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize,
+}
+
/// This trait allows creating an instance of `Self` which contains exactly one
/// [structurally pinned value](https://doc.rust-lang.org/std/pin/index.html#projections-and-structural-pinning).
///
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut`
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
` (3 preceding siblings ...)
2026-03-19 9:35 ` [PATCH 4/5] rust: pin-init: implement ZeroableOption for NonZero* integer types Benno Lossin
@ 2026-03-19 9:35 ` Benno Lossin
2026-03-19 11:07 ` Gary Guo
2026-03-19 9:42 ` [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
2026-03-26 8:23 ` Benno Lossin
6 siblings, 1 reply; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:35 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Christian Schrefl,
Oleksandr Babak
Cc: rust-for-linux, linux-kernel
From: Antonio Hickey <contact@antoniohickey.com>
`feature(raw_ref_op)` became stable in Rust 1.82.0 which is the current
MSRV of pin-init with no default features. Earlier Rust versions will
now need to enable `raw_ref_op` to continue to work with pin-init.
This reduces visual complexity and improves consistency with existing
reference syntax.
Suggested-by: Benno Lossin <lossin@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Closes: https://github.com/Rust-for-Linux/pin-init/issues/99
Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
Link: https://github.com/Rust-for-Linux/pin-init/commit/e27763004e2f6616b089437fbe9b3719cd72bd5c
[ Reworded commit message. - Benno ]
Signed-off-by: Benno Lossin <lossin@kernel.org>
---
rust/pin-init/README.md | 3 +--
rust/pin-init/examples/big_struct_in_place.rs | 1 +
rust/pin-init/examples/linked_list.rs | 1 +
rust/pin-init/examples/mutex.rs | 1 +
rust/pin-init/examples/pthread_mutex.rs | 1 +
rust/pin-init/examples/static_init.rs | 1 +
rust/pin-init/internal/src/init.rs | 8 ++++----
rust/pin-init/src/lib.rs | 8 ++++----
8 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/rust/pin-init/README.md b/rust/pin-init/README.md
index 6cee6ab1eb57..9095d6661ff6 100644
--- a/rust/pin-init/README.md
+++ b/rust/pin-init/README.md
@@ -160,7 +160,6 @@ actually does the initialization in the correct way. Here are the things to look
```rust
use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
use core::{
- ptr::addr_of_mut,
marker::PhantomPinned,
cell::UnsafeCell,
pin::Pin,
@@ -199,7 +198,7 @@ impl RawFoo {
unsafe {
pin_init_from_closure(move |slot: *mut Self| {
// `slot` contains uninit memory, avoid creating a reference.
- let foo = addr_of_mut!((*slot).foo);
+ let foo = &raw mut (*slot).foo;
let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
// Initialize the `foo`
diff --git a/rust/pin-init/examples/big_struct_in_place.rs b/rust/pin-init/examples/big_struct_in_place.rs
index de8612a5e27d..80f89b5f8fd6 100644
--- a/rust/pin-init/examples/big_struct_in_place.rs
+++ b/rust/pin-init/examples/big_struct_in_place.rs
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
use pin_init::*;
diff --git a/rust/pin-init/examples/linked_list.rs b/rust/pin-init/examples/linked_list.rs
index 226e33e4a957..119169e4dc41 100644
--- a/rust/pin-init/examples/linked_list.rs
+++ b/rust/pin-init/examples/linked_list.rs
@@ -3,6 +3,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
use core::{
cell::Cell,
diff --git a/rust/pin-init/examples/mutex.rs b/rust/pin-init/examples/mutex.rs
index e534c367f644..d53671f0edb8 100644
--- a/rust/pin-init/examples/mutex.rs
+++ b/rust/pin-init/examples/mutex.rs
@@ -3,6 +3,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
#![allow(clippy::missing_safety_doc)]
use core::{
diff --git a/rust/pin-init/examples/pthread_mutex.rs b/rust/pin-init/examples/pthread_mutex.rs
index 562ca5d3d08c..f3b5cc9b7134 100644
--- a/rust/pin-init/examples/pthread_mutex.rs
+++ b/rust/pin-init/examples/pthread_mutex.rs
@@ -4,6 +4,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
#[cfg(not(windows))]
mod pthread_mtx {
diff --git a/rust/pin-init/examples/static_init.rs b/rust/pin-init/examples/static_init.rs
index df562134a53c..f7e53d1a5ae6 100644
--- a/rust/pin-init/examples/static_init.rs
+++ b/rust/pin-init/examples/static_init.rs
@@ -3,6 +3,7 @@
#![allow(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(feature = "alloc", feature(allocator_api))]
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
#![allow(unused_imports)]
use core::{
diff --git a/rust/pin-init/internal/src/init.rs b/rust/pin-init/internal/src/init.rs
index c1c9400b090a..daa3f1c6466e 100644
--- a/rust/pin-init/internal/src/init.rs
+++ b/rust/pin-init/internal/src/init.rs
@@ -270,7 +270,7 @@ fn init_fields(
{
#value_prep
// SAFETY: TODO
- unsafe { #write(::core::ptr::addr_of_mut!((*#slot).#ident), #value_ident) };
+ unsafe { #write(&raw mut (*#slot).#ident, #value_ident) };
}
#(#cfgs)*
#[allow(unused_variables)]
@@ -293,7 +293,7 @@ fn init_fields(
// return when an error/panic occurs.
// - We also use `#data` to require the correct trait (`Init` or `PinInit`)
// for `#ident`.
- unsafe { #data.#ident(::core::ptr::addr_of_mut!((*#slot).#ident), #init)? };
+ unsafe { #data.#ident(&raw mut (*#slot).#ident, #init)? };
},
quote! {
// SAFETY: TODO
@@ -308,7 +308,7 @@ fn init_fields(
unsafe {
::pin_init::Init::__init(
#init,
- ::core::ptr::addr_of_mut!((*#slot).#ident),
+ &raw mut (*#slot).#ident,
)?
};
},
@@ -348,7 +348,7 @@ fn init_fields(
// SAFETY: We forget the guard later when initialization has succeeded.
let #guard = unsafe {
::pin_init::__internal::DropGuard::new(
- ::core::ptr::addr_of_mut!((*slot).#ident)
+ &raw mut (*slot).#ident
)
};
});
diff --git a/rust/pin-init/src/lib.rs b/rust/pin-init/src/lib.rs
index d09e7fe97eae..64eec095c859 100644
--- a/rust/pin-init/src/lib.rs
+++ b/rust/pin-init/src/lib.rs
@@ -172,7 +172,6 @@
//! # #![feature(extern_types)]
//! use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure};
//! use core::{
-//! ptr::addr_of_mut,
//! marker::PhantomPinned,
//! cell::UnsafeCell,
//! pin::Pin,
@@ -211,7 +210,7 @@
//! unsafe {
//! pin_init_from_closure(move |slot: *mut Self| {
//! // `slot` contains uninit memory, avoid creating a reference.
-//! let foo = addr_of_mut!((*slot).foo);
+//! let foo = &raw mut (*slot).foo;
//! let foo = UnsafeCell::raw_get(foo).cast::<bindings::foo>();
//!
//! // Initialize the `foo`
@@ -265,6 +264,7 @@
//! [Rust-for-Linux]: https://rust-for-linux.com/
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
+#![cfg_attr(USE_RUSTC_FEATURES, feature(raw_ref_op))]
#![cfg_attr(
all(any(feature = "alloc", feature = "std"), USE_RUSTC_FEATURES),
feature(new_uninit)
@@ -754,7 +754,7 @@ macro_rules! stack_try_pin_init {
///
/// ```rust
/// # use pin_init::*;
-/// # use core::{ptr::addr_of_mut, marker::PhantomPinned};
+/// # use core::marker::PhantomPinned;
/// #[pin_data]
/// #[derive(Zeroable)]
/// struct Buf {
@@ -768,7 +768,7 @@ macro_rules! stack_try_pin_init {
/// let init = pin_init!(&this in Buf {
/// buf: [0; 64],
/// // SAFETY: TODO.
-/// ptr: unsafe { addr_of_mut!((*this.as_ptr()).buf).cast() },
+/// ptr: unsafe { (&raw mut (*this.as_ptr()).buf).cast() },
/// pin: PhantomPinned,
/// });
/// let init = pin_init!(Buf {
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut`
2026-03-19 9:35 ` [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut` Benno Lossin
@ 2026-03-19 11:07 ` Gary Guo
2026-03-19 14:46 ` Benno Lossin
0 siblings, 1 reply; 13+ messages in thread
From: Gary Guo @ 2026-03-19 11:07 UTC (permalink / raw)
To: Benno Lossin, Gary Guo, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Antonio Hickey, Christian Schrefl,
Oleksandr Babak
Cc: rust-for-linux, linux-kernel
On Thu Mar 19, 2026 at 9:35 AM GMT, Benno Lossin wrote:
> From: Antonio Hickey <contact@antoniohickey.com>
>
> `feature(raw_ref_op)` became stable in Rust 1.82.0 which is the current
> MSRV of pin-init with no default features. Earlier Rust versions will
> now need to enable `raw_ref_op` to continue to work with pin-init.
>
> This reduces visual complexity and improves consistency with existing
> reference syntax.
>
> Suggested-by: Benno Lossin <lossin@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1148
> Closes: https://github.com/Rust-for-Linux/pin-init/issues/99
> Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
> Link: https://github.com/Rust-for-Linux/pin-init/commit/e27763004e2f6616b089437fbe9b3719cd72bd5c
> [ Reworded commit message. - Benno ]
> Signed-off-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
This version looks okay to me. Why is the linked upstream version adding
RUSTC_RAW_REF_OP_IS_STABLE cfg?
Best,
Gary
> ---
> rust/pin-init/README.md | 3 +--
> rust/pin-init/examples/big_struct_in_place.rs | 1 +
> rust/pin-init/examples/linked_list.rs | 1 +
> rust/pin-init/examples/mutex.rs | 1 +
> rust/pin-init/examples/pthread_mutex.rs | 1 +
> rust/pin-init/examples/static_init.rs | 1 +
> rust/pin-init/internal/src/init.rs | 8 ++++----
> rust/pin-init/src/lib.rs | 8 ++++----
> 8 files changed, 14 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut`
2026-03-19 11:07 ` Gary Guo
@ 2026-03-19 14:46 ` Benno Lossin
0 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 14:46 UTC (permalink / raw)
To: Gary Guo, Miguel Ojeda, Boqun Feng, Björn Roy Baron,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Antonio Hickey, Christian Schrefl, Oleksandr Babak
Cc: rust-for-linux, linux-kernel
On Thu Mar 19, 2026 at 12:07 PM CET, Gary Guo wrote:
> On Thu Mar 19, 2026 at 9:35 AM GMT, Benno Lossin wrote:
>> From: Antonio Hickey <contact@antoniohickey.com>
>>
>> `feature(raw_ref_op)` became stable in Rust 1.82.0 which is the current
>> MSRV of pin-init with no default features. Earlier Rust versions will
>> now need to enable `raw_ref_op` to continue to work with pin-init.
>>
>> This reduces visual complexity and improves consistency with existing
>> reference syntax.
>>
>> Suggested-by: Benno Lossin <lossin@kernel.org>
>> Link: https://github.com/Rust-for-Linux/linux/issues/1148
>> Closes: https://github.com/Rust-for-Linux/pin-init/issues/99
>> Signed-off-by: Antonio Hickey <contact@antoniohickey.com>
>> Link: https://github.com/Rust-for-Linux/pin-init/commit/e27763004e2f6616b089437fbe9b3719cd72bd5c
>> [ Reworded commit message. - Benno ]
>> Signed-off-by: Benno Lossin <lossin@kernel.org>
>
> Reviewed-by: Gary Guo <gary@garyguo.net>
>
> This version looks okay to me. Why is the linked upstream version adding
> RUSTC_RAW_REF_OP_IS_STABLE cfg?
Ah good catch. That's only in the build.rs file, but it's not needed any
more, I'll remove it.
Cheers,
Benno
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/5] pin-init upstream sync for v7.0
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
` (4 preceding siblings ...)
2026-03-19 9:35 ` [PATCH 5/5] rust: pin-init: replace `addr_of_mut!` with `&raw mut` Benno Lossin
@ 2026-03-19 9:42 ` Benno Lossin
2026-03-26 8:23 ` Benno Lossin
6 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-19 9:42 UTC (permalink / raw)
To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: rust-for-linux
On Thu Mar 19, 2026 at 10:35 AM CET, Benno Lossin wrote:
> This cycle we have no big changes in pin-init. This series is a
> collection of smaller improvements already merged upstream:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/105
> - https://github.com/Rust-for-Linux/pin-init/pull/110
> - https://github.com/Rust-for-Linux/pin-init/pull/101
> - https://github.com/Rust-for-Linux/pin-init/pull/102
> - https://github.com/Rust-for-Linux/pin-init/pull/108
>
> Next cycle might contain bigger changes, mainly support for tuple
> structs. And I'm also thinking of already starting with integrating
> zerocopy.
>
> While testing for the kernel, I noticed the following issue (already
> fixed in the patch in this series):
>
> - https://github.com/Rust-for-Linux/pin-init/pull/123
>
> This cycle we also had some unsoundness fixes that are already in rc4:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/111
> - https://github.com/Rust-for-Linux/pin-init/pull/117
>
> Lastly, there were some upstream-only changes:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/114
> - https://github.com/Rust-for-Linux/pin-init/pull/109
>
> Cheers,
> Benno
>
>
> Antonio Hickey (1):
> rust: pin-init: replace `addr_of_mut!` with `&raw mut`
>
> Benno Lossin (1):
> rust: pin-init: properly document let binding workaround
>
> Gary Guo (2):
> rust: pin-init: build: simplify use of nightly features
> rust: pin-init: doc: de-clutter documentation with fake-variadics
>
> Hamdan-Khan (1):
> rust: pin-init: implement ZeroableOption for NonZero* integer types
>
> rust/Makefile | 4 +-
> rust/pin-init/README.md | 3 +-
> rust/pin-init/examples/big_struct_in_place.rs | 3 +
> rust/pin-init/examples/linked_list.rs | 3 +-
> rust/pin-init/examples/mutex.rs | 3 +-
> rust/pin-init/examples/pthread_mutex.rs | 3 +-
> rust/pin-init/examples/static_init.rs | 3 +-
> rust/pin-init/internal/src/init.rs | 14 +++-
> rust/pin-init/internal/src/lib.rs | 2 +-
> rust/pin-init/src/lib.rs | 73 +++++++++++++------
> 10 files changed, 75 insertions(+), 36 deletions(-)
>
>
> base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
The title is of course wrong, it's supposed to be v7.1.
Cheers,
Benno
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0/5] pin-init upstream sync for v7.0
2026-03-19 9:35 [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
` (5 preceding siblings ...)
2026-03-19 9:42 ` [PATCH 0/5] pin-init upstream sync for v7.0 Benno Lossin
@ 2026-03-26 8:23 ` Benno Lossin
6 siblings, 0 replies; 13+ messages in thread
From: Benno Lossin @ 2026-03-26 8:23 UTC (permalink / raw)
To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich
Cc: rust-for-linux
On Thu Mar 19, 2026 at 10:35 AM CET, Benno Lossin wrote:
> This cycle we have no big changes in pin-init. This series is a
> collection of smaller improvements already merged upstream:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/105
> - https://github.com/Rust-for-Linux/pin-init/pull/110
> - https://github.com/Rust-for-Linux/pin-init/pull/101
> - https://github.com/Rust-for-Linux/pin-init/pull/102
> - https://github.com/Rust-for-Linux/pin-init/pull/108
>
> Next cycle might contain bigger changes, mainly support for tuple
> structs. And I'm also thinking of already starting with integrating
> zerocopy.
>
> While testing for the kernel, I noticed the following issue (already
> fixed in the patch in this series):
>
> - https://github.com/Rust-for-Linux/pin-init/pull/123
>
> This cycle we also had some unsoundness fixes that are already in rc4:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/111
> - https://github.com/Rust-for-Linux/pin-init/pull/117
>
> Lastly, there were some upstream-only changes:
>
> - https://github.com/Rust-for-Linux/pin-init/pull/114
> - https://github.com/Rust-for-Linux/pin-init/pull/109
>
> Cheers,
> Benno
>
>
> Antonio Hickey (1):
> rust: pin-init: replace `addr_of_mut!` with `&raw mut`
>
> Benno Lossin (1):
> rust: pin-init: properly document let binding workaround
>
> Gary Guo (2):
> rust: pin-init: build: simplify use of nightly features
> rust: pin-init: doc: de-clutter documentation with fake-variadics
>
> Hamdan-Khan (1):
> rust: pin-init: implement ZeroableOption for NonZero* integer types
Applied to pin-init-next yesterday, thanks everyone for contributing!
Cheers,
Benno
> rust/Makefile | 4 +-
> rust/pin-init/README.md | 3 +-
> rust/pin-init/examples/big_struct_in_place.rs | 3 +
> rust/pin-init/examples/linked_list.rs | 3 +-
> rust/pin-init/examples/mutex.rs | 3 +-
> rust/pin-init/examples/pthread_mutex.rs | 3 +-
> rust/pin-init/examples/static_init.rs | 3 +-
> rust/pin-init/internal/src/init.rs | 14 +++-
> rust/pin-init/internal/src/lib.rs | 2 +-
> rust/pin-init/src/lib.rs | 73 +++++++++++++------
> 10 files changed, 75 insertions(+), 36 deletions(-)
>
>
> base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
^ permalink raw reply [flat|nested] 13+ messages in thread