-
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
Feature flags + derive macros produce an incorrect "no such field" warning #11661
Comments
Likely also caused by #8434 |
I think this got worse recently - recent versions of RA have started to give me more warnings in this regard than I remember, at least for things involving For reference, this is a simplified version of what I'm writing which causes problems (this causes issues even on a brand new project with nothing else): #[derive(Clone)]
pub struct Results {
pub name: String,
#[cfg(target_os = "windows")]
pub windows_only_field: Option<String>,
} This can kinda be worked around in some cases by just manually deriving, but then that leads to clippy complaining for things like manually deriving |
this has several drawbacks that need to be addressed before going further on this: * it needs rust nightly * conditionally building the backtrace support makes rust-analyzer fail - see rust-lang/rust-analyzer#11661 * it will probably fail to display anything useful with the stripped binaries
Confirmed in the latest pre-release version (v0.4.1879 2024-03-13). This issue is fixed, thx to #16789 👍 |
Unfortunately I'm still running into this issue when I define my own custom derive macros with field attributes. I tried this both on v0.3.2129 and pre release v0.4.2128 |
@acycliczebra Can you please open a new issue with a minimal reproducible example? |
New issue opened here: #18224 My minimal reproducible example gives out a slightly different error message, but it's fundamentally the same problem. |
rust-analyzer version: rust-analyzer version: 5fae65d 2022-03-07 stable
rustc version: rustc 1.60.0-nightly (bfe156467 2022-01-22)
relevant settings: None
Minimal reproducible example can be found here. The code compiles, both with and without the feature flag, but RA shows an error.
The text was updated successfully, but these errors were encountered: