diff options
Diffstat (limited to 'tests/ui/generator/reinit-in-match-guard.rs')
-rw-r--r-- | tests/ui/generator/reinit-in-match-guard.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/generator/reinit-in-match-guard.rs b/tests/ui/generator/reinit-in-match-guard.rs new file mode 100644 index 000000000..260b341a5 --- /dev/null +++ b/tests/ui/generator/reinit-in-match-guard.rs @@ -0,0 +1,25 @@ +// build-pass + +#![feature(generators)] + +#![allow(unused_assignments, dead_code)] + +fn main() { + let _ = || { + let mut x = vec![22_usize]; + std::mem::drop(x); + match y() { + true if { + x = vec![]; + false + } => {} + _ => { + yield; + } + } + }; +} + +fn y() -> bool { + true +} |