rust-lang / rust-lang/rust-analyzer
inactive_code regression with Facet: code is inactive due to #[cfg] directives: debug_assertions is enabled
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.4.2994-standalone (e4e67338ea 2026-07-31)
rustc version: rustc 1.97.0 (2d8144b78 2026-07-07)
editor or extension: VSCode pre-release: 0.4.2994
relevant settings: N/A
repository link (if public, optional): N/A
code snippet to reproduce:
cargo new rust-analyzer_inactive_code_repro
cd rust-analyzer_inactive_code_repro
cargo add facet
main.rs:
pub struct Pre;
#[derive(facet::Facet)]
pub struct Foo(u32);
pub struct Bar;
fn main() {
let foo = Foo(42);
println!("Hello, world! {}", foo.0);
}
Foo on line 5 is grayed out with code is inactive due to #[cfg] directives: debug_assertions is enabledrust-analyzer[inactive_code](https://rust-analyzer.github.io/book/diagnostics.html#inactive_code)
This is a fairly new regression; and the latest non-pre-release does not experience this.
Potentiality related: #22306 cc: @ChayimFriedman2, @ShoyuVanilla
edit: This is with facet = "0.46.5" the latest as of today.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the shown cargo project, facet = "0.46.5", and the #[derive(facet::Facet)] declaration. Start by tracing rust-analyzer's inactive_code diagnostic and compare the pre-release behavior with the latest non-pre-release; done means Foo is no longer incorrectly reported inactive while genuine #[cfg] diagnostics remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100