rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.1k stars 1.57k forks source link

Checking crates which warn about building in release mode now fails #8516

Open mattico opened 3 years ago

mattico commented 3 years ago

After updating to the latest RA I started getting this issue:

image

It's a bit unusual but synopsys-usb-otg prints a warning if you're compiling in debug mode. RA interprets this as an error so I get an ⚠ in the status bar and a notification every time it runs. Completion and problem detection seem to still work, but it's annoying to get spurious error notifications.

Adding

"rust-analyzer.checkOnSave.extraArgs": ["--release"], // synopsys-usb-otg requires release

doesn't seem to help. The check-on-save system doesn't error anyway, just the initial check when launching code or when clicking on the ⚠ rust-analyzer status bar segment to reload it.

It's a bit silly but an option to run cargo check with --release would help. Not sure what else to do.

mattico commented 3 years ago

Hold on, I completely missed the error: could not compile lazy_static in the notification, let me check the logs.

mattico commented 3 years ago

Yes, the notification is caused just by the synopsys-usb-otg warning:

[ERROR rust_analyzer::reload] failed to switch build data: cargo check failed:
warning: synopsys-usb-otg is being compiled in debug mode. This driver works reliably only in release mode!
    Checking mainboardfw v0.2.1 (C:\Users\matth\Code\mainboard-firmware\firmware)
error: could not compile `mainboardfw`

To learn more, run the command again with --verbose.

The lazy_static error was just from having multiple directories with different targets open in one vscode workspace (I think).

flodiebold commented 3 years ago

Can you try the current nightly?

mattico commented 3 years ago

With current nightly the rust-analyzer load status never stops spinning but the cargo check error doesn't appear.