-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linker error on proc macros that depend on defmt
#14190
Comments
Does it work if you disable |
I just gave it a go (restarted all of VSCode for good measure), it doesn't :( |
Maybe try a |
If disabling the wrapper helps, you can try setting this as a workaround: https://github.com/lnicola/rust-analyzer/blob/563bd9c24a0620906e4640f57262ea33e48687f0/crates/rust-analyzer/src/bin/rustc_wrapper.rs#L24. EDIT: no, that won't work. |
Failed again after |
Strange, for me it works without disabling that setting. Expanding the second macro call in that example, I get My
|
That's the expected expansion (and the one you get through It started happening when I first added the |
Ahah, removing ALL of my rust related settings did work, now to find the true culprit. Thanks for letting me know that it could work, I have Settings Sync enabled so whatever setting is messing it up, it was synced between my machines. |
Did you check the contents of Of course, |
Still looping through settings to find the issue |
AHAH: |
I can confirm, enabling |
Aight, we were debating whether |
It's a bit weird. We seem to load |
And thanks, by the way! |
Oh, it actually has a linker script: https://github.com/knurling-rs/defmt/blob/main/defmt/defmt.x.in. |
defmt
I might have done it wrong, but I tried adding the following if env::var_os("DEP_DEFMT_LINKS").is_some() {
println!("cargo:rustc-link-arg-examples=-Tdefmt.x");
} to |
We've dropped For future reference, the I'll update the link which pointed to the branch to point to the last problematic commit |
Is this still an issue? |
I can't spot any problems on bd645773e65912428d09fd408009de99352fcd73 with all features enabled, let's close this. |
First of all, thank you for the immense work you've been doing.
Issue description
Apologies, I haven't been able to make a minimal reproduction of the issue I'm running into while working on proc-macros in zenoh's
keformatter
branch. I'll try to provide as much information as possible.Behaviour
Since working on new proc-macros last week,
rust-analyzer
keeps on showing afailed to run build scripts
error, stating in server logs that it "could not compilezenoh-macros
" (belongs to the workspace,commons/zenoh-macros
).In VSCode, this causes every usage of
zenoh-macros
's members to be marked with "proc macrounstable
not expanded: no proc macro dylib present" (unstable
for instance expands correctly onmaster
).In Lapce, the error notification appears, but macros appear to be expanded correctly regardless, since type inference and documentation in the
examples/examples/z_formats.rs
file works.Note that when building the project,
zenoh-macros
builds fine, so this issue seems to be RA-specific.Suspected cause
It appears that rust-analyzer drives the build slightly differently, leading to invalid linkage description files, since linkers on both Windows and Linux complain about syntax errors in
lib.def
andlist
(passed through--version-script
) respectively.Server logs on Windows
Server logs on Linux
The directories that contain the incriminated files are deleted by the time I get their path in the logs, so I haven't been able to inspect the files to try and find out more.
Impacted platforms
Linux (Manjaro)
rust-analyzer version: 0.3.1412-standalone
rustc version: rustc 1.67.1 (d5a82bbd2 2023-02-07)
relevant settings: None to my knowledge
Windows
rust-analyzer version: 0.3.1410-standalone (a6603fc 2023-02-16)
rustc version: rustc 1.67.1 (d5a82bbd2 2023-02-07)
relevant settings: None to my knowledge
The text was updated successfully, but these errors were encountered: