]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs
New upstream version 1.28.0~beta.14+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-report-with-custom-diagnostic.rs
index cdfee2e8a704957be2e1a96ea93130390af2d409..2bc65287982af0f431171a5b0366a6d49113c4a4 100644 (file)
@@ -16,6 +16,8 @@ fn main() { #![rustc_error] // rust-lang/rust#49855
     //~^ mutable borrow occurs here
     let z = &x; //~ ERROR cannot borrow
     //~^ immutable borrow occurs here
+    z.use_ref();
+    y.use_mut();
 }
 
 fn foo() {
@@ -27,6 +29,8 @@ fn foo() {
             //~^ immutable borrow occurs here
             let z = &mut x; //~ ERROR cannot borrow
             //~^ mutable borrow occurs here
+            z.use_mut();
+            y.use_ref();
         }
         false => ()
     }
@@ -40,5 +44,10 @@ fn bar() {
         //~^ first mutable borrow occurs here
         let z = &mut x; //~ ERROR cannot borrow
         //~^ second mutable borrow occurs here
+        z.use_mut();
+        y.use_mut();
     };
 }
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { }  }
+impl<T> Fake for T { }