diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/let-else/let-else-check.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/let-else/let-else-check.rs b/src/test/ui/let-else/let-else-check.rs new file mode 100644 index 000000000..9e32cbef7 --- /dev/null +++ b/src/test/ui/let-else/let-else-check.rs @@ -0,0 +1,19 @@ +#![feature(let_else)] + +#![deny(unused_variables)] + +fn main() { + // type annotation, attributes + #[allow(unused_variables)] + let Some(_): Option<u32> = Some(Default::default()) else { + let x = 1; // OK + return; + }; + + let Some(_): Option<u32> = Some(Default::default()) else { + let x = 1; //~ ERROR unused variable: `x` + return; + }; + + let x = 1; //~ ERROR unused variable: `x` +} |