Skip to content

#[cfg(...)] ignores namespace #53489

Closed
Closed
@kennytm

Description

@kennytm

Repro:

fn main() {
    println!("           cfg(a) = {}", cfg!(a));
    println!("cfg(something::a) = {}", cfg!(something::a));
}
$ rustc --cfg 'a' 1.rs && ./1
           cfg(a) = true
cfg(something::a) = true

$ rustc --cfg 'something::a' 1.rs && ./1
           cfg(a) = true
cfg(something::a) = true

$ rustc --cfg 'what::a' 1.rs && ./1
           cfg(a) = true
cfg(something::a) = true

while I expected these should print true/false, false/true and false/false instead.

(Note: this also affects --print cfg which something::a is collapsed to a)

cc @petrochenkov @eddyb


$ rustc -vV
rustc 1.30.0-nightly (33b923fd4 2018-08-18)
binary: rustc
commit-hash: 33b923fd44c5c5925e635815fce68bdf1f98740f
commit-date: 2018-08-18
host: x86_64-apple-darwin
release: 1.30.0-nightly
LLVM version: 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions