Skip to content

inactive-code incorrectly applied when #![cfg(os)] is used in module file #17817

@chris-oo

Description

@chris-oo

I have a minimal repro of this issue here: https://github.com/chris-oo/ra-inactive-code-repro

Essentially, if a module file is cfg gated with #![cfg(windows)] or any OS that you're not currently targeting, rust-analyzer incorrectly marks the whole parent file as greyed out with the inactive code warning instead of just marking the module as greyed out. It also marks the module that should be inactive as not greyed out, but with no type completions.

image

This code does compile with rustc and runs as expected. It seemed to repro with both release and pre-release versions.

Pictured RA version: v0.4.2064 (pre-release)
Rust version: 1.80

Metadata

Metadata

Assignees

Labels

Broken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions