1
Fork 0

correct scoping for shadow lints

This commit is contained in:
llogiq 2015-08-25 23:48:22 +02:00
parent 6df102cdab
commit 51a211503d
2 changed files with 12 additions and 1 deletions

View file

@ -19,4 +19,12 @@ fn main() {
let x = first(x); //~ERROR: x is shadowed by first(x) which reuses
let y = 1;
let x = y; //~ERROR: x is shadowed by y in this declaration
let o = Some(1u8);
if let Some(p) = o { assert_eq!(1, p); }
match o {
Some(p) => p, // no error, because the p above is in its own scope
None => 0,
};
}