-
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
#[cfg_attr(..., path = "submod_gated.rs")] mod submod;
makes RA recognize submod_gated.rs, discarding cfg_attr and submod.rs
#17371
Comments
Hmm, the attributes are configured at that point, so the issue is probably in rust-analyzer/crates/hir-expand/src/attrs.rs Lines 127 to 156 in 0c795a7
|
As a sidenote, I find embassy codebase uses conditional compilation a lot by combining cfg_attr and path attribute macro . So a similar case worth considering is like this: #[cfg(feature = "_arch")]
#[cfg_attr(feature = "arch-avr", path = "arch/avr.rs")]
#[cfg_attr(feature = "arch-cortex-m", path = "arch/cortex_m.rs")]
#[cfg_attr(feature = "arch-riscv32", path = "arch/riscv32.rs")]
#[cfg_attr(feature = "arch-std", path = "arch/std.rs")]
#[cfg_attr(feature = "arch-wasm", path = "arch/wasm.rs")]
mod arch; RA mistakenly recognizes arch/avr.rs as arch module file, when |
Hmm those are rustc errors though, not rust-analyzer? This sounds like your |
Do you have |
No, I never have them in configuration file. That's what surprises me. |
Weird, these cfg error doesn't exist on vscode. embassy has own vscode settings which I didn't use in neovim. I have to double check on my RA settings. |
Well, there are some interesting things going on:
{
"rust-analyzer.cargo.features": [],
"rust-analyzer.cargo.allFeatures": true,
} It's valid, and RA only respects the second and causes the issue.
|
I'd love to do that but some of the third party clients have complained about us fixing up the config so we had to still accept that setting. We could maybe try removing that compat layer now. Accepting that is just a backwards compat change. The bigger issue here is that https://github.com/mrcjkb/rustaceanvim/tree/master has a very bad default for that config here. There is a reason why |
See #4604 (comment) and the following collapsed comments |
We could maybe just warn in the logs and the like if a client sends outdated config keys that are still accepted for now |
rust-analyzer version: rust-analyzer 1.80.0-nightly (7c52d2d 2024-06-03)
rustc version: rustc 1.80.0-nightly (7c52d2db6 2024-06-03)
editor or extension: neovim
relevant settings: None
repository link (if public, optional): None. But I found the problem from embassy-executor. For reproducible code, see below.
code snippet to reproduce:
Currently, RA marks
submod.rs
asfile not included in crate hierarchy
whengated
feature is nowhere enabled, and treatssubmod_gated.rs
as the default submod file, discardingcfg_attr
.The text was updated successfully, but these errors were encountered: