<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/stable/linux.git/rust/pin-init/examples, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=master</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/'/>
<updated>2026-08-05T10:36:16+00:00</updated>
<entry>
<title>rust: pin-init: add `raw_init` and `raw_try_init` and recommend over `__init`</title>
<updated>2026-08-05T10:36:16+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=d5492db2bf30b7e617e41d4fe3dba22475a1a354'/>
<id>urn:sha1:d5492db2bf30b7e617e41d4fe3dba22475a1a354</id>
<content type='text'>
The `__init` method is not designed to be a public API (existence of "__"
is a hint for this); but currently there is no other API that allows raw
initialization on pointers. Add `raw_init` and `raw_try_init` and recommend
people to use this instead if raw pointer initialization is needed.

Link: https://patch.msgid.link/20260729-merge-init-v2-3-26adf47109e7@garyguo.net
[ Renamed from `ptr_[try_]init` to `raw_[try_]init`. - Gary ]
Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: merge `__pinned_init` and `__init`</title>
<updated>2026-08-03T12:36:42+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=91665820d9bf511e0c3fdf3edb464ba23130dafe'/>
<id>urn:sha1:91665820d9bf511e0c3fdf3edb464ba23130dafe</id>
<content type='text'>
These functions have the same requirements and are also required to execute
the same code. Prevent duplication by merging them to the single function
and document the additional relaxation of `Init::__init` on both the merged
function and the safety requirement of `Init`.

The existing `__pinned_init` function is deprecated and kept for
compatibility for existing users. For `cfg(kernel)`, it is soft-deprecated
for now and will be removed when all users are migrated.

Link: https://patch.msgid.link/20260729-merge-init-v2-2-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: examples: use `Wrapper::pin_init` instead of manual reimplementation</title>
<updated>2026-08-03T12:36:34+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-29T15:38:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c998b661b7c024dfd6dd893927506e32ee8a42c5'/>
<id>urn:sha1:c998b661b7c024dfd6dd893927506e32ee8a42c5</id>
<content type='text'>
`UnsafeCell` gains the method via the extension trait `Wrapper`.

Link: https://patch.msgid.link/20260729-merge-init-v2-1-26adf47109e7@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: examples: fix incorrect drop</title>
<updated>2026-07-13T11:09:41+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-10T16:20:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=554d1afffc391f938ca58ab74b82238ac2d29c37'/>
<id>urn:sha1:554d1afffc391f938ca58ab74b82238ac2d29c37</id>
<content type='text'>
Remove the drop and associated clippy allow. The warning reported by Clippy
here is genuine; the binding created is `Pin&lt;&amp;mut T&gt;` so dropping it does
nothing. `stack_pin_init` created bindings are only dropped at the end of
scope.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-2-8fa16cde87ae@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: examples: fix `useless_borrows_in_formatting` clippy warning</title>
<updated>2026-05-10T22:00:51+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-05T11:51:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=430654211d566f86e8ee533ff1b01a42be6b602c'/>
<id>urn:sha1:430654211d566f86e8ee533ff1b01a42be6b602c</id>
<content type='text'>
Clippy 1.97 introduces new `useless_borrows_in_formatting` warning which
fires on the examples as we have `&amp;*expr` where the format macro takes
reference already. Remove the extra borrow.

Link: https://patch.msgid.link/20260505115138.2466966-1-gary@kernel.org
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: bump minimum Rust version to 1.82</title>
<updated>2026-05-10T21:58:33+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-04-28T13:10:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=531fdc2c341bded76817cef935c5fe97d88d643b'/>
<id>urn:sha1:531fdc2c341bded76817cef935c5fe97d88d643b</id>
<content type='text'>
Following the kernel minimum version bump in commit f32fb9c58a5b ("rust:
bump Rust minimum supported version to 1.85.0 (Debian Trixie)"), bump
pin-init's minimum Rust version to 1.82.

This removes the `lint_reasons` feature which is stabilized in 1.81 and the
`raw_ref_ops` and `new_uninit` features which are stabilized in 1.82.

Given we do not use any features that are stabilized in 1.82..=1.85 range,
and pin-init crate is useful for other projects which may have their own
MSRV requirements, the minimum version is not straightly bumped to 1.85.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-2-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: examples: mark as `#[inline]` all `From::from()`s for `Error`</title>
<updated>2026-05-10T21:58:33+00:00</updated>
<author>
<name>Alistair Francis</name>
<email>alistair.francis@wdc.com</email>
</author>
<published>2026-04-28T13:10:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=be7ea321a2d3a3d4151c9304f50fa1fe26487a81'/>
<id>urn:sha1:be7ea321a2d3a3d4151c9304f50fa1fe26487a81</id>
<content type='text'>
There was a recent request in kernel [1] to mark as `#[inline]` the
simple `From::from()` functions implemented for `Error`.

Thus mark all of the existing

    impl From&lt;...&gt; for Error {
        fn from(err: ...) -&gt; Self {
            ...
        }
    }

functions as `#[inline]`.

While in pin-init crate the relevant code is just examples, it
nevertheless does not hurt to use good practice for them.

Suggested-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1]
Signed-off-by: Alistair Francis &lt;alistair.francis@wdc.com&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
[ Reworded commit message - Gary ]
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-1-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: replace `addr_of_mut!` with `&amp;raw mut`</title>
<updated>2026-03-25T09:57:53+00:00</updated>
<author>
<name>Antonio Hickey</name>
<email>contact@antoniohickey.com</email>
</author>
<published>2026-03-19T09:35:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=09808839c7aa6695ceff5cd822c18b0d9550184d'/>
<id>urn:sha1:09808839c7aa6695ceff5cd822c18b0d9550184d</id>
<content type='text'>
`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 &lt;lossin@kernel.org&gt;
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 &lt;contact@antoniohickey.com&gt;
Link: https://github.com/Rust-for-Linux/pin-init/commit/e27763004e2f6616b089437fbe9b3719cd72bd5c
[ Reworded commit message. - Benno ]
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260319093542.3756606-6-lossin@kernel.org
Signed-off-by: Benno Lossin &lt;lossin@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: properly document let binding workaround</title>
<updated>2026-03-25T09:56:53+00:00</updated>
<author>
<name>Benno Lossin</name>
<email>lossin@kernel.org</email>
</author>
<published>2026-03-19T09:35:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=960c37cbcba78730ee175f4887ffcdf523385c53'/>
<id>urn:sha1:960c37cbcba78730ee175f4887ffcdf523385c53</id>
<content type='text'>
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}`
        --&gt; src/lib.rs:1160:66
         |
    1160 | pub const unsafe fn cast_init&lt;T, U, E&gt;(init: impl Init&lt;T, E&gt;) -&gt; impl Init&lt;U, E&gt; {
         |                                                                  ^^^^^^^^^^^^^^^
         |
    note: ...which requires borrow-checking `cast_init`...
        --&gt; src/lib.rs:1160:1
         |
    1160 | pub const unsafe fn cast_init&lt;T, U, E&gt;(init: impl Init&lt;T, E&gt;) -&gt; impl Init&lt;U, E&gt; {
         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    note: ...which requires const checking `cast_init`...
        --&gt; src/lib.rs:1160:1
         |
    1160 | pub const unsafe fn cast_init&lt;T, U, E&gt;(init: impl Init&lt;T, E&gt;) -&gt; impl Init&lt;U, E&gt; {
         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         = 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}`
        --&gt; src/lib.rs:1160:66
         |
    1160 | pub const unsafe fn cast_init&lt;T, U, E&gt;(init: impl Init&lt;T, E&gt;) -&gt; impl Init&lt;U, E&gt; {
         |                                                                  ^^^^^^^^^^^^^^^
         = 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 ]
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260319093542.3756606-3-lossin@kernel.org
Signed-off-by: Benno Lossin &lt;lossin@kernel.org&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: build: simplify use of nightly features</title>
<updated>2026-03-25T09:56:16+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-03-19T09:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=002a121b16c3a20c6e0ff24fc8dad6dab59730f9'/>
<id>urn:sha1:002a121b16c3a20c6e0ff24fc8dad6dab59730f9</id>
<content type='text'>
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 &lt;gary@garyguo.net&gt;
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 ]
Link: https://patch.msgid.link/20260319093542.3756606-2-lossin@kernel.org
Signed-off-by: Benno Lossin &lt;lossin@kernel.org&gt;
</content>
</entry>
</feed>
