rust-lang / rust-lang/rust-analyzer

inactive_code regression with Facet: code is inactive due to #[cfg] directives: debug_assertions is enabled

Open
#22,984 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-macro C-bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.