Open
Description
B { X }
is a shorthand for B { X: X }
and X
here can be intepreted as an item reference, rather than a binding. I don't know if this is actually a bug or not. Possible fixes are:
- Leave it as is.
- Leave it as is with some warning.
- Force
X
be interpreted as a binding and let it fail to compile (due to local-global shadowing).
const X : i32 = 10;
struct B {
X: i32,
}
fn main() {
match (B { X: 9 }) {
B { X } => println!("Foo!"),
B { .. } => println!("Bar!"),
}
}
- Current behavior:
Bar!
is printed. - Possible expected behaviors: as-is or some warning/error emitted.
- Meta:
rustc 1.20.0-nightly (ab5bec255 2017-06-22)