diff options
Diffstat (limited to 'src/test/ui/borrowck/borrowck-drop-from-guard.rs')
-rw-r--r-- | src/test/ui/borrowck/borrowck-drop-from-guard.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.rs b/src/test/ui/borrowck/borrowck-drop-from-guard.rs new file mode 100644 index 000000000..4995029a7 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.rs @@ -0,0 +1,11 @@ +fn foo(_:String) {} + +fn main() +{ + let my_str = "hello".to_owned(); + match Some(42) { + Some(_) if { drop(my_str); false } => {} + Some(_) => {} + None => { foo(my_str); } //~ ERROR [E0382] + } +} |