]> git.proxmox.com Git - rustc.git/blobdiff - src/test/compile-fail/region-object-lifetime-in-coercion.rs
New upstream version 1.24.1+dfsg1
[rustc.git] / src / test / compile-fail / region-object-lifetime-in-coercion.rs
index 2da414befd8979312cc7b1c3e18466197d5f9f7a..687b2c344a3b755d42f6baa392b31ddc18b1741a 100644 (file)
 // Test that attempts to implicitly coerce a value into an
 // object respect the lifetime bound on the object type.
 
-#![feature(box_syntax)]
-
-trait Foo : ::std::marker::MarkerTrait {}
+trait Foo {}
 impl<'a> Foo for &'a [u8] {}
 
 fn a(v: &[u8]) -> Box<Foo + 'static> {
-    let x: Box<Foo + 'static> = box v; //~ ERROR does not fulfill the required lifetime
+    let x: Box<Foo + 'static> = Box::new(v);
+    //~^ ERROR cannot infer an appropriate lifetime due to conflicting
     x
 }
 
 fn b(v: &[u8]) -> Box<Foo + 'static> {
-    box v //~ ERROR does not fulfill the required lifetime
+    Box::new(v)
+        //~^ ERROR cannot infer an appropriate lifetime due to conflicting
 }
 
 fn c(v: &[u8]) -> Box<Foo> {
     // same as previous case due to RFC 599
 
-    box v //~ ERROR does not fulfill the required lifetime
+    Box::new(v)
+        //~^ ERROR cannot infer an appropriate lifetime due to conflicting
 }
 
 fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
-    box v //~ ERROR does not fulfill the required lifetime
+    Box::new(v)
+        //~^ ERROR cannot infer an appropriate lifetime due to conflicting
 }
 
 fn e<'a:'b,'b>(v: &'a [u8]) -> Box<Foo+'b> {
-    box v // OK, thanks to 'a:'b
+    Box::new(v) // OK, thanks to 'a:'b
 }
 
 fn main() { }