]> git.lizzy.rs Git - rust.git/commitdiff
region-ebr-does-not-outlive-static: reuse old test instead
authorNiko Matsakis <niko@alum.mit.edu>
Wed, 6 Dec 2017 21:32:04 +0000 (16:32 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Thu, 7 Dec 2017 10:28:04 +0000 (05:28 -0500)
src/test/compile-fail/regions-static-bound.rs
src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.rs [deleted file]
src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.stderr [deleted file]

index de695e72d07e4bab6bb979e71d515313f4764bc8..9de8ca196f8ce9a021cf37d99607ec25da4f721a 100644 (file)
@@ -8,17 +8,27 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// revisions: ll nll
+//[nll] compile-flags: -Znll -Zborrowck=mir
+
 fn static_id<'a,'b>(t: &'a ()) -> &'static ()
     where 'a: 'static { t }
 fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static ()
     where 'a: 'b, 'b: 'static { t }
 fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
-    t //~ ERROR E0312
+    t //[ll]~ ERROR E0312
+        //[nll]~^ WARNING not reporting region error due to -Znll
+        //[nll]~| ERROR free region `'a` does not outlive free region `'static`
 }
 
 fn error(u: &(), v: &()) {
-    static_id(&u); //~ ERROR cannot infer an appropriate lifetime
-    static_id_indirect(&v); //~ ERROR cannot infer an appropriate lifetime
+    static_id(&u); //[ll]~ ERROR cannot infer an appropriate lifetime
+    //[nll]~^ WARNING not reporting region error due to -Znll
+    static_id_indirect(&v); //[ll]~ ERROR cannot infer an appropriate lifetime
+    //[nll]~^ WARNING not reporting region error due to -Znll
+
+    // FIXME(#45827) -- MIR type checker shortcomings mean we don't
+    // see these errors (yet) in nll mode.
 }
 
 fn main() {}
diff --git a/src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.rs
deleted file mode 100644 (file)
index fc8b48b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 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.
-
-// Basic test for free regions in the NLL code. This test ought to
-// report an error due to a reborrowing constraint. Right now, we get
-// a variety of errors from the older, AST-based machinery (notably
-// borrowck), and then we get the NLL error at the end.
-
-// compile-flags:-Znll -Zborrowck=mir
-
-fn foo<'a>(x: &'a u32) -> &'static u32
-    where 'static: 'a
-{
-    &*x
-        //~^ WARN not reporting region error due to -Znll
-        //~| ERROR free region `'a` does not outlive free region `'static`
-}
-
-fn main() { }
diff --git a/src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-ebr-does-not-outlive-static.stderr
deleted file mode 100644 (file)
index d3fbbb8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-warning: not reporting region error due to -Znll
-  --> $DIR/region-ebr-does-not-outlive-static.rs:21:5
-   |
-21 |     &*x
-   |     ^^^
-
-error: free region `'a` does not outlive free region `'static`
-  --> $DIR/region-ebr-does-not-outlive-static.rs:21:5
-   |
-21 |     &*x
-   |     ^^^
-
-error: aborting due to previous error
-