rust-lang / rust-lang/rust-analyzer
macro behind optional flag is still checked
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description

lib.rs
pub fn stuff() {
#[cfg(f = "1")]
tracing::dispatcher::set_global_default(todo!());
#[cfg(f = "1")]
tracing::info!(todo!());
}
Cargo.toml
[package]
name = "cfg-stuff"
version = "0.1.0"
edition = "2021"
[dependencies]
tracing = {version = "0.1.34", optional = true }
gives "unresolved macro tracing::info!" on line 5, but no unresolved stuff on line 3
rust-analyzer version: 5d5bbec9b60010dd
rustc version: rustc 1.62.0-nightly (30f386087 2022-05-05)
relevant settings: "rust-analyzer.procMacro.enable": true
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
Start by reproducing the report with the lib.rs and Cargo.toml examples, using the stated rust-analyzer and proc-macro settings. Compare diagnostics for the two cfg-gated statements; done means the macro behind the disabled optional dependency is no longer reported as unresolved while the configuration behavior remains correct.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100