-
Notifications
You must be signed in to change notification settings - Fork 1.8k
#[cfg_attr(rust_analyzer, allow(dead_code))] does not work #15612
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
Comments
that diagnostic comes from rustc, |
Should it be set? This is a lint ultimately being surfaced by rust-analyzer. As a user I don't particularly care about the mechanism, only that I've asked rust-analyzer to disable this lint and it isn't. Feels weird to me. |
r-a invoking cargo check yields the same results as what you get when invoking it manually which is what I would expect. Additionally, if we were to set the cfg for the cargo invocation that would ultimately cause rebuilds whenever you have r-a invoke checks and you building your project yourself. |
I know that's how it's implemented, but the presentation shouldn't necessarily be tied to the implementation IMO. To a user that doesn't know this implementation detail, this presents very weirdly. In a future where r-a doesn't need to invoke cargo check anymore, and everything is librarified, will this suddenly start working? If so, should it be working now? |
Maybe this shows that adding the |
Personally I feel like changing |
I was very reluctant to add it in general because it felt like a bad idea, but it's kind of required because of how bad r-a works in certain scenarios currently... My idea was for it to always be an escape hatch really.
If they were equivalent then there would be no point in even having |
Uh oh!
There was an error while loading. Please reload this page.
rust-analyzer version: 0.3.1657-standalone (326f37e 2023-09-10
rustc version: rustc 1.72.0 (5680fa18f 2023-08-23)
Based on #15528 I assumed this would be possible. My code currently has a
rust_analyzer_fix
feature we've defined and been using for this purpose, and after trying to replace the feature withcfg(rust_analyzer)
this was the only thing that didn't transition cleanly.Repro code:
lib.rs:
What I see:

The text was updated successfully, but these errors were encountered: