Skip to content

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

Description

@rlabrecque

rust-analyzer version: rust-analyzer version: 0.4.2994-standalone (e4e6733 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingA-macromacro expansionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions