summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-if-with-else.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/borrowck-if-with-else.rs')
-rw-r--r--tests/ui/borrowck/borrowck-if-with-else.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-if-with-else.rs b/tests/ui/borrowck/borrowck-if-with-else.rs
new file mode 100644
index 000000000..69d450c59
--- /dev/null
+++ b/tests/ui/borrowck/borrowck-if-with-else.rs
@@ -0,0 +1,11 @@
+fn foo(x: isize) { println!("{}", x); }
+
+fn main() {
+ let x: isize;
+ if 1 > 2 {
+ println!("whoops");
+ } else {
+ x = 10;
+ }
+ foo(x); //~ ERROR E0381
+}