* [PATCH] rust: proc-macro2: rebuild if the version text changes
@ 2026-01-22 5:41 Miguel Ojeda
2026-01-22 9:21 ` Alice Ryhl
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-22 5:41 UTC (permalink / raw)
To: Miguel Ojeda, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, linux-kbuild
The Rust compiler cannot use dependencies built by other versions, e.g.:
error[E0514]: found crate `proc_macro2` compiled by an incompatible version of rustc
--> rust/quote/ext.rs:5:5
|
5 | use proc_macro2::{TokenStream, TokenTree};
| ^^^^^^^^^^^
|
= note: the following crate versions were found:
crate `proc_macro2` compiled by rustc 1.92.0 (ded5c06cf 2025-12-08): ./rust/libproc_macro2.rlib
= help: please recompile that crate using this compiler (rustc 1.93.0 (254b59607 2026-01-19)) (consider running `cargo clean` first)
Thus trigger a rebuild if the version text changes like we do in other
top-level cases (e.g. see commit aeb0e24abbeb ("kbuild: rust: replace
proc macros dependency on `core.o` with the version text")).
The build errors for now are hard to trigger, since we do not yet use
the new crates we just introduced (the use cases are coming in the next
merge window), but they can still be seen if e.g. one manually removes
one of the targets, so fix it already.
Fixes: 158a3b72118a ("rust: proc-macro2: enable support in kbuild")
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/proc-macro2/lib.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/rust/proc-macro2/lib.rs b/rust/proc-macro2/lib.rs
index 7b78d065d51c..5d408943fa0d 100644
--- a/rust/proc-macro2/lib.rs
+++ b/rust/proc-macro2/lib.rs
@@ -1,5 +1,9 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
+// When fixdep scans this, it will find this string `CONFIG_RUSTC_VERSION_TEXT`
+// and thus add a dependency on `include/config/RUSTC_VERSION_TEXT`, which is
+// touched by Kconfig when the version string from the compiler changes.
+
//! [![github]](https://github.com/dtolnay/proc-macro2) [![crates-io]](https://crates.io/crates/proc-macro2) [![docs-rs]](crate)
//!
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
base-commit: 2af6ad09fc7dfe9b3610100983cccf16998bf34d
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] rust: proc-macro2: rebuild if the version text changes
2026-01-22 5:41 [PATCH] rust: proc-macro2: rebuild if the version text changes Miguel Ojeda
@ 2026-01-22 9:21 ` Alice Ryhl
2026-01-22 11:43 ` Gary Guo
2026-01-23 10:03 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Alice Ryhl @ 2026-01-22 9:21 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kbuild
On Thu, Jan 22, 2026 at 06:41:35AM +0100, Miguel Ojeda wrote:
> The Rust compiler cannot use dependencies built by other versions, e.g.:
>
> error[E0514]: found crate `proc_macro2` compiled by an incompatible version of rustc
> --> rust/quote/ext.rs:5:5
> |
> 5 | use proc_macro2::{TokenStream, TokenTree};
> | ^^^^^^^^^^^
> |
> = note: the following crate versions were found:
> crate `proc_macro2` compiled by rustc 1.92.0 (ded5c06cf 2025-12-08): ./rust/libproc_macro2.rlib
> = help: please recompile that crate using this compiler (rustc 1.93.0 (254b59607 2026-01-19)) (consider running `cargo clean` first)
>
> Thus trigger a rebuild if the version text changes like we do in other
> top-level cases (e.g. see commit aeb0e24abbeb ("kbuild: rust: replace
> proc macros dependency on `core.o` with the version text")).
>
> The build errors for now are hard to trigger, since we do not yet use
> the new crates we just introduced (the use cases are coming in the next
> merge window), but they can still be seen if e.g. one manually removes
> one of the targets, so fix it already.
>
> Fixes: 158a3b72118a ("rust: proc-macro2: enable support in kbuild")
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: proc-macro2: rebuild if the version text changes
2026-01-22 5:41 [PATCH] rust: proc-macro2: rebuild if the version text changes Miguel Ojeda
2026-01-22 9:21 ` Alice Ryhl
@ 2026-01-22 11:43 ` Gary Guo
2026-01-23 9:45 ` Miguel Ojeda
2026-01-23 10:03 ` Miguel Ojeda
2 siblings, 1 reply; 5+ messages in thread
From: Gary Guo @ 2026-01-22 11:43 UTC (permalink / raw)
To: Miguel Ojeda, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, linux-kbuild
On Thu Jan 22, 2026 at 5:41 AM GMT, Miguel Ojeda wrote:
> The Rust compiler cannot use dependencies built by other versions, e.g.:
>
> error[E0514]: found crate `proc_macro2` compiled by an incompatible version of rustc
> --> rust/quote/ext.rs:5:5
> |
> 5 | use proc_macro2::{TokenStream, TokenTree};
> | ^^^^^^^^^^^
> |
> = note: the following crate versions were found:
> crate `proc_macro2` compiled by rustc 1.92.0 (ded5c06cf 2025-12-08): ./rust/libproc_macro2.rlib
> = help: please recompile that crate using this compiler (rustc 1.93.0 (254b59607 2026-01-19)) (consider running `cargo clean` first)
>
> Thus trigger a rebuild if the version text changes like we do in other
> top-level cases (e.g. see commit aeb0e24abbeb ("kbuild: rust: replace
> proc macros dependency on `core.o` with the version text")).
>
> The build errors for now are hard to trigger, since we do not yet use
> the new crates we just introduced (the use cases are coming in the next
> merge window), but they can still be seen if e.g. one manually removes
> one of the targets, so fix it already.
>
> Fixes: 158a3b72118a ("rust: proc-macro2: enable support in kbuild")
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> rust/proc-macro2/lib.rs | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/rust/proc-macro2/lib.rs b/rust/proc-macro2/lib.rs
> index 7b78d065d51c..5d408943fa0d 100644
> --- a/rust/proc-macro2/lib.rs
> +++ b/rust/proc-macro2/lib.rs
> @@ -1,5 +1,9 @@
> // SPDX-License-Identifier: Apache-2.0 OR MIT
>
> +// When fixdep scans this, it will find this string `CONFIG_RUSTC_VERSION_TEXT`
> +// and thus add a dependency on `include/config/RUSTC_VERSION_TEXT`, which is
> +// touched by Kconfig when the version string from the compiler changes.
We use the same trick for multiple crates now. Is this something that can done
in Makefile or it has to be in the source?
Best,
Gary
> +
> //! [![github]](https://github.com/dtolnay/proc-macro2) [![crates-io]](https://crates.io/crates/proc-macro2) [![docs-rs]](crate)
> //!
> //! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
>
> base-commit: 2af6ad09fc7dfe9b3610100983cccf16998bf34d
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: proc-macro2: rebuild if the version text changes
2026-01-22 11:43 ` Gary Guo
@ 2026-01-23 9:45 ` Miguel Ojeda
0 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-23 9:45 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kbuild
On Thu, Jan 22, 2026 at 12:43 PM Gary Guo <gary@garyguo.net> wrote:
>
> We use the same trick for multiple crates now. Is this something that can done
> in Makefile or it has to be in the source?
Good question: it can (we do it for `core`), but Kbuild preferred we
avoid it since it is considered an implementation detail, so I only
use that way for `core.o` since we cannot apply it in that case since
we don't control the sources.
Having said that, for the new build system, I would prefer to ideally
generate this automatically (and then it shouldn't be a problem to
depend on that since it would be a "single" place to update it).
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: proc-macro2: rebuild if the version text changes
2026-01-22 5:41 [PATCH] rust: proc-macro2: rebuild if the version text changes Miguel Ojeda
2026-01-22 9:21 ` Alice Ryhl
2026-01-22 11:43 ` Gary Guo
@ 2026-01-23 10:03 ` Miguel Ojeda
2 siblings, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-01-23 10:03 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, linux-kbuild
On Thu, Jan 22, 2026 at 6:41 AM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> The Rust compiler cannot use dependencies built by other versions, e.g.:
>
> error[E0514]: found crate `proc_macro2` compiled by an incompatible version of rustc
> --> rust/quote/ext.rs:5:5
> |
> 5 | use proc_macro2::{TokenStream, TokenTree};
> | ^^^^^^^^^^^
> |
> = note: the following crate versions were found:
> crate `proc_macro2` compiled by rustc 1.92.0 (ded5c06cf 2025-12-08): ./rust/libproc_macro2.rlib
> = help: please recompile that crate using this compiler (rustc 1.93.0 (254b59607 2026-01-19)) (consider running `cargo clean` first)
>
> Thus trigger a rebuild if the version text changes like we do in other
> top-level cases (e.g. see commit aeb0e24abbeb ("kbuild: rust: replace
> proc macros dependency on `core.o` with the version text")).
>
> The build errors for now are hard to trigger, since we do not yet use
> the new crates we just introduced (the use cases are coming in the next
> merge window), but they can still be seen if e.g. one manually removes
> one of the targets, so fix it already.
>
> Fixes: 158a3b72118a ("rust: proc-macro2: enable support in kbuild")
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Applied to `rust-fixes` -- thanks everyone!
I am applying this one fairly fast since Rust 1.93.0 is out and folks
may trigger it in linux-next.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-23 10:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 5:41 [PATCH] rust: proc-macro2: rebuild if the version text changes Miguel Ojeda
2026-01-22 9:21 ` Alice Ryhl
2026-01-22 11:43 ` Gary Guo
2026-01-23 9:45 ` Miguel Ojeda
2026-01-23 10:03 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox