<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/next/linux-next.git/rust/pin-init/internal, branch master</title>
<subtitle>The linux-next integration testing tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/'/>
<updated>2026-07-13T11:11:01+00:00</updated>
<entry>
<title>rust: pin-init: internal: generate brace in macro for init code blocks</title>
<updated>2026-07-13T11:11:01+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-10T16:20:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=751ecd5a19cf2c55807bf30f35bafc32e179a19c'/>
<id>urn:sha1:751ecd5a19cf2c55807bf30f35bafc32e179a19c</id>
<content type='text'>
`init!` support interleaving code execution and initialization, and code
execution is done using `_: { ... }` syntax. If the code inside block is a
single statement, Rust may add a lint about unused braces, but the
suggestion will be incorrect as block is required by pin-init.

Currently we use `unused_brace` to suppress this, but this affect
everything nested inside as well. Use an alternative approach by generating
the block from the macro, then rustc will know to not emit the lint.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-5-8fa16cde87ae@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: internal: remove `allow` and `expect`s that don't fire</title>
<updated>2026-07-13T11:10:05+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-07-10T16:20:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=c1722ae6fefe3723f31656172f4bc196225506dc'/>
<id>urn:sha1:c1722ae6fefe3723f31656172f4bc196225506dc</id>
<content type='text'>
Most warnings are suppressed from external macro expansions by default.
Thus remove `allow` and `expect`s for them.

Note that `unfulfilled_lint_expectations` is one of them too. This means
that all of our `expect`s inside macros do nothing, and actually mislead
people to the lints would be actually emitted without them.

Reviewed-by: Benno Lossin &lt;lossin@kernel.org&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-4-8fa16cde87ae@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: internal: error on duplicate `#[pin]` attribute</title>
<updated>2026-07-13T11:08:46+00:00</updated>
<author>
<name>Luiz Georg</name>
<email>luizgngeorg@gmail.com</email>
</author>
<published>2026-07-10T16:20:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=f26f2f22c6d16d6019fbd1248681e57a1a533bd3'/>
<id>urn:sha1:f26f2f22c6d16d6019fbd1248681e57a1a533bd3</id>
<content type='text'>
Duplicated `#[pin]` has no effect, thus error if misused.

Reported-by: Mohamad Alsadhan &lt;mo@sdhn.cc&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/119
Signed-off-by: Luiz Georg &lt;luizgngeorg@gmail.com&gt;
Link: https://patch.msgid.link/20260710-pin-init-sync-v1-1-8fa16cde87ae@garyguo.net
[ Reworded commit message, and change the logic so code generation still
  continue after reporting error - Gary ]
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin_init: internal: use `loop {}` to produce never value</title>
<updated>2026-05-29T20:58:36+00:00</updated>
<author>
<name>Gary Guo</name>
<email>gary@garyguo.net</email>
</author>
<published>2026-05-08T15:29:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=d2f309227952e73966682f348161094e40eb6440'/>
<id>urn:sha1:d2f309227952e73966682f348161094e40eb6440</id>
<content type='text'>
In the `init!`/`pin_init!` macros, we rely on a trick that assigns never
(`!`) values to all mentioned fields in never-executed code to let the
compiler check that all fields have been initialized.

Currently we use `::core::panic!()` to produce this value, but before Rust
1.91.0, it creates outlined `panic_cold_explicit` functions which do not
get removed by the optimizer, thus leaving dead code behind in the binary.
This has been fixed by [1], which lands in Rust 1.91.0+, higher than the
kernel minimum version 1.85.0.

This causes ~200 dead `panic_cold_explicit` instances being included in the
binary, with ~90 of them from nova-core's usage of pin-init.

Work around the issue by using `loop {}` which creates the never value
without macro expansion or function call at all. All instances of
`panic_cold_explicit` outside libcore are removed by this change in my
kernel build.

Link: https://github.com/rust-lang/rust/pull/145304 [1]
Link: https://patch.msgid.link/20260508152950.833635-1-gary@kernel.org
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: internal: suppress `non_snake_case` lint in `[pin_]init!`</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Mirko Adzic</name>
<email>adzicmirko97@gmail.com</email>
</author>
<published>2026-05-27T17:19:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5423ef9d4db852835746001d0840231227bb0e39'/>
<id>urn:sha1:5423ef9d4db852835746001d0840231227bb0e39</id>
<content type='text'>
Allows `non_snake_case` lint on local variables generated in `[pin_]init!`.

Conceptually the identifiers in `[pin_]init!` just references the field
names, and are not defining them, so the warning should not be generated,
similar to how constructing a struct with non-snake-case field names do no
generate these warnings.

Reported-by: Gary Guo &lt;gary@garyguo.net&gt;
Closes: https://github.com/Rust-for-Linux/pin-init/issues/125
Closes: https://lore.kernel.org/rust-for-linux/DGTBJBIVFZ2K.2F1ZEFGY0G7NK@garyguo.net/
Fixes: 42415d163e5d ("rust: pin-init: add references to previously initialized fields")
Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
[ Reworded commit message - Gary ]
Link: https://patch.msgid.link/20260527-pin-init-sync-v1-3-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: internal: suppress `non_snake_case` lint in `#[pin_data]`</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Mirko Adzic</name>
<email>adzicmirko97@gmail.com</email>
</author>
<published>2026-05-27T17:19:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=e6405dca10de4136a880d218b015663a41d92a54'/>
<id>urn:sha1:e6405dca10de4136a880d218b015663a41d92a54</id>
<content type='text'>
Allows `non_snake_case` lint on struct fields generated by `#[pin_data]`.

Since the same warning will be reported by the compiler on the struct
definition, having extra warnings for the generated code is unnecessary
and confusing.

Signed-off-by: Mirko Adzic &lt;adzicmirko97@gmail.com&gt;
Link: https://patch.msgid.link/20260527-pin-init-sync-v1-2-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</content>
</entry>
<entry>
<title>rust: pin-init: internal: pin_data: filter non-`#[cfg]` attr in generated code</title>
<updated>2026-05-29T20:34:53+00:00</updated>
<author>
<name>Martin Kletzander</name>
<email>mkletzan@redhat.com</email>
</author>
<published>2026-05-27T17:19:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=28ba76f374bf5fec9e5bf5035ffe90e4c6b05682'/>
<id>urn:sha1:28ba76f374bf5fec9e5bf5035ffe90e4c6b05682</id>
<content type='text'>
When using a macro with custom attributes in a `#[pin_data]` struct it
can mess up the generated code. The generated code needs nothing more than
the `#[cfg]` attribute, thus strip away all other attributes.

[ Rebased and updated to only include `#[cfg]` instead of both `#[cfg]` and
  `#[doc]`; doc is not needed for the generated hidden items. - Gary ]

Signed-off-by: Martin Kletzander &lt;mkletzan@redhat.com&gt;
Co-developed-by: Gary Guo &lt;gary@garyguo.net&gt;
Link: https://patch.msgid.link/20260527-pin-init-sync-v1-1-e20335ed2501@garyguo.net
Signed-off-by: Gary Guo &lt;gary@garyguo.net&gt;
</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.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=6fb5912c92926025a7e205d53feb73c3478c79a1'/>
<id>urn:sha1: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>
</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.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5483a97dd2dfcaf8540dba0a80b68a400c4c1861'/>
<id>urn:sha1: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>
</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.rulkc.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=57b0a0d7e5a063edceb50bffa648b49591112896'/>
<id>urn:sha1: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>
</entry>
</feed>
