-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support specifying #[cfg(panic = ...)]
#11794
Comments
|
Ah I didn't notice that. Yeah that won't work then… 😂 |
How does one best work around this? |
You can set
in your settings as a workaround for now |
Now both Setting
EDIT: I can work around that use EDIT 2: It seems that cargo ignores |
#[cfg(panic = "...")]
was recently stablized in nightly. At the moment, rust-analyzer always usespanic = "unwind"
, making it difficult to write code for"abort"
, similar to #7225.My first thought was to set
[profile.dev] panic = "abort"
inCargo.toml
, but that didn't work. As it turns out, RA gets the built-in cfgs from runningcargo -Z unstable-options rustc --print cfg
, which specifically ignores profile settings (rust-lang/cargo#9357):But if we pass
--print
to rustc directly withcargo rustc --lib -- --print cfg
, it will use the settings fromprofile.dev
then. This kind of problem had never came up before, sincepanic
is the first and only cfg that can be affected by cargo profiles (aside fromdebug_assertions
which RA hardcodes anyway).https://github.com/rust-analyzer/rust-analyzer/blob/b594f9c441cf12319d10c14ba6a511d5c9db1b87/crates/project_model/src/rustc_cfg.rs#L40-L44
The text was updated successfully, but these errors were encountered: