about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-11-15 16:07:48 +0000
committerbors <bors@rust-lang.org>2017-11-15 16:07:48 +0000
commit88a28ff6028cf197ed6b4185d8cd4887f05e3e07 (patch)
treeba93d344ef887de5fb4c4fd17ebb88d287c3be31 /src/test
parentce2b8a4944f1983759cb7d0e8d35a8bb889dbee6 (diff)
parent9e35fd262f8ca57d755259448df4e7b601cb236a (diff)
Auto merge of #45936 - mikhail-m1:mir-borrowck-storage-dead, r=arielb1
add `StorageDead` handling

fix #45642
r? @arielb1
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/borrowck/borrowck-storage-dead.rs30
-rw-r--r--src/test/compile-fail/issue-25579.rs3
2 files changed, 31 insertions, 2 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-storage-dead.rs b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs
new file mode 100644
index 00000000000..5ef502acd81
--- /dev/null
+++ b/src/test/compile-fail/borrowck/borrowck-storage-dead.rs
@@ -0,0 +1,30 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z emit-end-regions -Z borrowck-mir
+
+fn ok() {
+    loop {
+        let _x = 1;
+    }
+}
+
+fn fail() {
+    loop {
+        let x: i32;
+        let _ = x + 1; //~ERROR (Ast) [E0381]
+                       //~^ ERROR (Mir) [E0381]
+    }
+}
+
+fn main() {
+    ok();
+    fail();
+}
diff --git a/src/test/compile-fail/issue-25579.rs b/src/test/compile-fail/issue-25579.rs
index 7da80d2852e..4437e20fc42 100644
--- a/src/test/compile-fail/issue-25579.rs
+++ b/src/test/compile-fail/issue-25579.rs
@@ -18,11 +18,10 @@ enum Sexpression {
 
 fn causes_ice(mut l: &mut Sexpression) {
     loop { match l {
-        &mut Sexpression::Num(ref mut n) => {}, //[mir]~ ERROR (Mir) [E0384]
+        &mut Sexpression::Num(ref mut n) => {},
         &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
                                                   //[mir]~^ ERROR (Ast) [E0499]
                                                   //[mir]~| ERROR (Mir) [E0506]
-                                                  //[mir]~| ERROR (Mir) [E0384]
                                                   //[mir]~| ERROR (Mir) [E0499]
             l = &mut **expr; //[ast]~ ERROR [E0506]
                              //[mir]~^ ERROR (Ast) [E0506]