Skip to content

Commit 87417cc

Browse files
J3m3ojeda
authored andcommitted
scripts: generate_rust_analyzer: syn: treat std as a dependency
Fix the `generate_rust_analyzer.py` script to ensure that the `rust-project.json` it produces includes `std` in the `deps` field for the `syn` crate. `syn` directly references items from `std`, so rust-analyzer should treat it as a dependency to provide correct IDE support. For example, `syn::Punctuated` contains fields of type `Vec<..>` and `Option<..>`, both of which come from the standard library prelude. With `std` listed in the `deps` field, rust-analyzer can infer the types of these fields instead of showing `{unknown}`. Verified the explicit uses of `std` using: grep -rn 'std::' rust/syn/ Fixes: 7374017 ("rust: syn: enable support in kbuild") Signed-off-by: Jesung Yang <y.j3ms.n@gmail.com> Reviewed-by: Tamir Duberstein <tamird@gmail.com> Tested-by: Tamir Duberstein <tamird@gmail.com> Link: https://patch.msgid.link/6dbdf6e1c1639ae381ca9ab7041f84728ffa2267.1764062688.git.y.j3ms.n@gmail.com [ Reworded title. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 1b83ef9 commit 87417cc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/generate_rust_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def append_sysroot_crate(
103103
append_crate(
104104
"syn",
105105
srctree / "rust" / "syn" / "lib.rs",
106-
["proc_macro", "proc_macro2", "quote"],
106+
["std", "proc_macro", "proc_macro2", "quote"],
107107
cfg=crates_cfgs["syn"],
108108
)
109109

0 commit comments

Comments
 (0)