]> git.lizzy.rs Git - rust.git/blobdiff - src/test/compile-fail/impl-trait/loan-extend.rs
Auto merge of #35856 - phimuemue:master, r=brson
[rust.git] / src / test / compile-fail / impl-trait / loan-extend.rs
index ceaa8f4eed72348dfa1e34e2db89c42b261c22eb..8dfcb08cff339b4153037ec430e0aa462a871b78 100644 (file)
 fn borrow<'a, T>(_: &'a mut T) -> impl Copy { () }
 
 fn main() {
-    //~^ NOTE reference must be valid for the block
     let long;
     let mut short = 0;
-    //~^ NOTE but borrowed value is only valid for the block suffix following statement 1
     long = borrow(&mut short);
     //~^ ERROR `short` does not live long enough
-}
+    //~| NOTE does not live long enough
+    //~| NOTE values in a scope are dropped in the opposite order they are created
+} //~ borrowed value dropped before borrower