]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/variance/variance-invariant-arg-object.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / variance / variance-invariant-arg-object.rs
index 886d263c45768652ae9b5cf3aa67dfd17984c150..cc8820fbac69e97b79edda9118611cb8e36a638f 100644 (file)
@@ -1,5 +1,9 @@
 #![allow(dead_code)]
 
+// revisions: base nll
+// ignore-compare-mode-nll
+//[nll] compile-flags: -Z borrowck=mir
+
 trait Get<T> : 'static {
     fn get(&self, t: T) -> T;
 }
@@ -8,14 +12,18 @@ fn get_min_from_max<'min, 'max>(v: Box<dyn Get<&'max i32>>)
                                 -> Box<dyn Get<&'min i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn get_max_from_min<'min, 'max, G>(v: Box<dyn Get<&'min i32>>)
                                    -> Box<dyn Get<&'max i32>>
     where 'max : 'min
 {
-    v //~ ERROR mismatched types
+    v
+    //[base]~^ ERROR mismatched types
+    //[nll]~^^ ERROR lifetime may not live long enough
 }
 
 fn main() { }