<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/rust/pin-init/src, branch v7.2-rc1</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>rust: pin-init: remove `E` from `InitClosure`</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-27T17:19:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=f85906616ec70d1d0178073b16ebd1c7f6ff1ee7'/>
<id>f85906616ec70d1d0178073b16ebd1c7f6ff1ee7</id>
<content type='text'>
Move `E` from type to trait impl block. This greatly shortens the
monomorphized type names. The `__pinned_init` function name is only
slightly shortened as it still encodes the `E` as part of `PinInit&lt;T, E&gt;`
in the symbol.

`T` cannot be moved to trait impl block otherwise it will start to conflict
with the `impl Init&lt;T&gt; for T` as Rust cannot deduce that there're no types
that fulfill `T: FnOnce(*mut T)`.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-6-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move `E` from type to trait impl block. This greatly shortens the
monomorphized type names. The `__pinned_init` function name is only
slightly shortened as it still encodes the `E` as part of `PinInit&lt;T, E&gt;`
in the symbol.

`T` cannot be moved to trait impl block otherwise it will start to conflict
with the `impl Init&lt;T&gt; for T` as Rust cannot deduce that there're no types
that fulfill `T: FnOnce(*mut T)`.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-6-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: move `InitClosure` out from `__internal`</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-27T17:19:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=79bc923ae2a60a227907697abab4ed26c3fc3670'/>
<id>79bc923ae2a60a227907697abab4ed26c3fc3670</id>
<content type='text'>
The `__internal` module is for exposing internal items publicly to
procedural macros (pin-init-internal). Types that are crate-local only can
just have proper visibility and does not need to be in `__internal`.

The type name of `InitClosure` can often shows up in symbol names, this
reduces the length slightly.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-5-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `__internal` module is for exposing internal items publicly to
procedural macros (pin-init-internal). Types that are crate-local only can
just have proper visibility and does not need to be in `__internal`.

The type name of `InitClosure` can often shows up in symbol names, this
reduces the length slightly.

Link: https://patch.msgid.link/20260527-pin-init-sync-v1-5-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: docs: fix typos in MaybeZeroable documentation</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Xiaobo Liu</name>
<email>cppcoffee@gmail.com</email>
</author>
<published>2026-05-27T17:19:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2a02b4f96f7bb77ae4cef5d41494f83d01d022dd'/>
<id>2a02b4f96f7bb77ae4cef5d41494f83d01d022dd</id>
<content type='text'>
Signed-off-by: Xiaobo Liu &lt;cppcoffee@gmail.com&gt;
Link: https://patch.msgid.link/20260527-pin-init-sync-v1-4-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Xiaobo Liu &lt;cppcoffee@gmail.com&gt;
Link: https://patch.msgid.link/20260527-pin-init-sync-v1-4-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: internal: project using full slot</title>
<updated>2026-05-18T11:21:28+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-12T12:09:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6fb5912c92926025a7e205d53feb73c3478c79a1'/>
<id>6fb5912c92926025a7e205d53feb73c3478c79a1</id>
<content type='text'>
Instead of projecting using pointer to a field project the full slot. This
further shifts the code generation from the initializer site to the struct
definition site, which means less code is generated overall.

It also makes the safety comment easier to justify, as now the projection
is done by the `#[pin_data]` macro which has full visibility of pinnedness
of fields.

The field alignment could also be checked on the `#[pin_data]` side;
however, since `init!()` macro works for other type of structs, we cannot
remove the alignment check from `init!`/`pin_init!` side anyway, so I opted
to still keep the alignment check in init.rs.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of projecting using pointer to a field project the full slot. This
further shifts the code generation from the initializer site to the struct
definition site, which means less code is generated overall.

It also makes the safety comment easier to justify, as now the projection
is done by the `#[pin_data]` macro which has full visibility of pinnedness
of fields.

The field alignment could also be checked on the `#[pin_data]` side;
however, since `init!()` macro works for other type of structs, we cannot
remove the alignment check from `init!`/`pin_init!` side anyway, so I opted
to still keep the alignment check in init.rs.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: internal: project slots instead of references</title>
<updated>2026-05-18T11:21:13+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-12T12:09:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5483a97dd2dfcaf8540dba0a80b68a400c4c1861'/>
<id>5483a97dd2dfcaf8540dba0a80b68a400c4c1861</id>
<content type='text'>
By projecting slots, the `pin_init!` and `init!` code path can be more
unified. This also reduces the amount of macro-generated code and shifts
them to the shared infrastructure.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By projecting slots, the `pin_init!` and `init!` code path can be more
unified. This also reduces the amount of macro-generated code and shifts
them to the shared infrastructure.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: internal: make `make_closure` inherent methods</title>
<updated>2026-05-18T11:18:06+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-12T12:09:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=57b0a0d7e5a063edceb50bffa648b49591112896'/>
<id>57b0a0d7e5a063edceb50bffa648b49591112896</id>
<content type='text'>
The `InitData` and `PinData` traits do not need to exist, the inference
helpers could be inherent methods instead.

There is no risk for calling the wrong methods even when user defines it,
as inherent methods take priority over trait methods.

With this change, it unlocks the possibility of attaching additional bounds
to the method per type, which is not possible for trait methods.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `InitData` and `PinData` traits do not need to exist, the inference
helpers could be inherent methods instead.

There is no risk for calling the wrong methods even when user defines it,
as inherent methods take priority over trait methods.

With this change, it unlocks the possibility of attaching additional bounds
to the method per type, which is not possible for trait methods.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: internal: use marker on drop guard type for pinned fields</title>
<updated>2026-05-18T11:18:06+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-12T12:09:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=27693a56e8a697f78db535aad2d5267f286e1f51'/>
<id>27693a56e8a697f78db535aad2d5267f286e1f51</id>
<content type='text'>
Instead of projecting the created reference, simply create drop guards with
different marker types and have the `let_binding()` method of guards of
different marker produce different type instead.

This allows more flexible lifetime as this is now controlled by the guard.
This will be needed when implementing self-referential fields.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of projecting the created reference, simply create drop guards with
different marker types and have the `let_binding()` method of guards of
different marker produce different type instead.

This allows more flexible lifetime as this is now controlled by the guard.
This will be needed when implementing self-referential fields.

Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: internal: add `PhantomInvariant` and `PhantomInvariantLifetime`</title>
<updated>2026-05-14T19:18:14+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-12T12:09:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fea304ec875454360a3be106e0baad96032bf9fe'/>
<id>fea304ec875454360a3be106e0baad96032bf9fe</id>
<content type='text'>
Currently, the `pin_init` library has an `Invariant` type alias, and it is
instantiated using `PhantomData`. Generated code from `pin_data` on the
other hand cannot access the crate-local type alias, so it generates
`PhantomData&lt;fn(T) -&gt; T&gt;` directly. This is all very inconsistent, despite
the exact same use case of ensuring invariance.

Add `PhantomInvariant` and `PhantomInvariantLifetime` and switch all users
that need to express the concept of invariance to use these. They're
polyfills of unstable types in the same names in the Rust standard library.

Link: https://patch.msgid.link/20260512-pin-init-sync-v1-3-81963130dfbd@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, the `pin_init` library has an `Invariant` type alias, and it is
instantiated using `PhantomData`. Generated code from `pin_data` on the
other hand cannot access the crate-local type alias, so it generates
`PhantomData&lt;fn(T) -&gt; T&gt;` directly. This is all very inconsistent, despite
the exact same use case of ensuring invariance.

Add `PhantomInvariant` and `PhantomInvariantLifetime` and switch all users
that need to express the concept of invariance to use these. They're
polyfills of unstable types in the same names in the Rust standard library.

Link: https://patch.msgid.link/20260512-pin-init-sync-v1-3-81963130dfbd@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: cleanup workaround for old Rust compiler</title>
<updated>2026-05-10T21:58:34+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-04-28T13:10:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=3dc01266cdf02b7abf733b022f6b936be567fc17'/>
<id>3dc01266cdf02b7abf733b022f6b936be567fc17</id>
<content type='text'>
The workaround mentions it's for Rust versions before 1.81. The minimum is
now 1.82, thus clean up.

Link: https://patch.msgid.link/20260428-pin-init-sync-v1-9-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The workaround mentions it's for Rust versions before 1.81. The minimum is
now 1.82, thus clean up.

Link: https://patch.msgid.link/20260428-pin-init-sync-v1-9-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rust: pin-init: extend `impl_zeroable_option` macro to handle generics</title>
<updated>2026-05-10T21:58:33+00:00</updated>
<author>
<name>Mohamad Alsadhan</name>
<email>mo@sdhn.cc</email>
</author>
<published>2026-04-28T13:10:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=de54c2cb052952df2a6f91617471d1f02f213d4e'/>
<id>de54c2cb052952df2a6f91617471d1f02f213d4e</id>
<content type='text'>
Improve impl_zeroable_option macro to handle generic impls for types
like `&amp;T`, `&amp;mut T`, `NonNull&lt;T&gt;`, and others (for which `Option&lt;T&gt;`
is guaranteed to be zeroable) with similar approach to
`impl_zeroable`.

Also, update old declarations to use generics e.g. `NonZeroU8` to
`NonZero&lt;u8&gt;`.

Signed-off-by: Mohamad Alsadhan &lt;mo@sdhn.cc&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-4-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Improve impl_zeroable_option macro to handle generic impls for types
like `&amp;T`, `&amp;mut T`, `NonNull&lt;T&gt;`, and others (for which `Option&lt;T&gt;`
is guaranteed to be zeroable) with similar approach to
`impl_zeroable`.

Also, update old declarations to use generics e.g. `NonZeroU8` to
`NonZero&lt;u8&gt;`.

Signed-off-by: Mohamad Alsadhan &lt;mo@sdhn.cc&gt;
Reviewed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260428-pin-init-sync-v1-4-07f9bd3859fb@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
