Re: [PATCH 00/18] `syn` support

From: Jesung Yang

Date: Thu Nov 20 2025 - 23:37:58 EST


Gary Guo <gary@xxxxxxxxxxx> wrote:
> I can build with these patches and I've verified that libmacros can
> indeed reference types within `syn`, so also

Hi,

I've been trying to apply this patch on the current rust-next HEAD
494de8f67b1e ("rust: sync: replace kernel::c_str! with C-Strings") and
test it, since I need this series for my future patch revision.

Unfortunately, when I make the following change:

diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index 793f712dbf7c..084633b517be 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -444,3 +444,14 @@ pub fn paste(input: TokenStream) -> TokenStream {
pub fn kunit_tests(attr: TokenStream, ts: TokenStream) -> TokenStream {
kunit::kunit_tests(attr, ts)
}
+
+use syn::{
+ parse_macro_input,
+ DeriveInput, //
+};
+
+#[proc_macro_attribute]
+pub fn dummy(input: TokenStream) -> TokenStream {
+ let input = parse_macro_input!(input as DeriveInput);
+ todo!()
+}

It fails to compile:

error[E0432]: unresolved import `syn`
--> rust/macros/lib.rs:448:5
|
448 | use syn::{
| ^^^ use of unresolved module or unlinked crate `syn`
|
= help: you might be missing a crate named `syn`

error: aborting due to 1 previous error

It appears that the vendored crates are indeed compiled; I can see some
build artifacts like `rust/libsyn.rlib`, `libquote.rlib`, etc.

For reference, here's the sequence of commands I ran to compile the
kernel:

make LLVM=1 ARCH=arm64 rustavailable
make LLVM=1 ARCH=arm64 defconfig
scripts/config --enable CONFIG_RUST
scripts/config --enable CONFIG_SAMPLES
scripts/config --enable CONFIG_SAMPLES_RUST
scripts/config --module CONFIG_SAMPLE_RUST_MINIMAL
scripts/config --enable CONFIG_KUNIT
scripts/config --enable CONFIG_RUST_KERNEL_DOCTESTS
make LLVM=1 ARCH=arm64 olddefconfig
make LLVM=1 ARCH=arm64 CLIPPY=1 -j8

I'd appreciate any guidance on steps I might be missing. Thanks in
advance!

Best Regards,
Jesung