]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / borrowck / two-phase-nonrecv-autoref.rs
index 918c7a1be197ac630948749e3ae4ed3ec8b0c4e3..3d395d1f264a0d8407b3c17ca2e3cc08188ba12b 100644 (file)
@@ -1,7 +1,6 @@
-// revisions: nll
-//[nll]compile-flags: -Z borrowck=mir
+// revisions: base
 
-//[g2p]compile-flags: -Z borrowck=mir -Z two-phase-beyond-autoref
+//[g2p]compile-flags: -Z two-phase-beyond-autoref
 // the above revision is disabled until two-phase-beyond-autoref support is better
 
 // This is a test checking that when we limit two-phase borrows to
@@ -49,30 +48,26 @@ fn overloaded_call_traits() {
 
     fn twice_ten_sm<F: FnMut(i32) -> i32>(f: &mut F) {
         f(f(10));
-        //[nll]~^   ERROR cannot borrow `*f` as mutable more than once at a time
-        //[g2p]~^^ ERROR cannot borrow `*f` as mutable more than once at a time
+        //~^ ERROR cannot borrow `*f` as mutable more than once at a time
     }
     fn twice_ten_si<F: Fn(i32) -> i32>(f: &mut F) {
         f(f(10));
     }
     fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
         f(f(10));
-        //[nll]~^   ERROR use of moved value: `f`
-        //[g2p]~^^  ERROR use of moved value: `f`
+        //~^ ERROR use of moved value: `f`
     }
 
     fn twice_ten_om(f: &mut dyn FnMut(i32) -> i32) {
         f(f(10));
-        //[nll]~^   ERROR cannot borrow `*f` as mutable more than once at a time
-        //[g2p]~^^  ERROR cannot borrow `*f` as mutable more than once at a time
+        //~^ ERROR cannot borrow `*f` as mutable more than once at a time
     }
     fn twice_ten_oi(f: &mut dyn Fn(i32) -> i32) {
         f(f(10));
     }
     fn twice_ten_oo(f: Box<dyn FnOnce(i32) -> i32>) {
         f(f(10));
-        //[nll]~^   ERROR use of moved value: `f`
-        //[g2p]~^^  ERROR use of moved value: `f`
+        //~^ ERROR use of moved value: `f`
     }
 
     twice_ten_sm(&mut |x| x + 1);
@@ -110,8 +105,7 @@ fn coerce_unsized() {
 
     // This is not okay.
     double_access(&mut a, &a);
-    //[nll]~^   ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
-    //[g2p]~^^  ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
+    //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable [E0502]
 
     // But this is okay.
     a.m(a.i(10));
@@ -136,12 +130,14 @@ impl IndexMut<i32> for I {
 fn coerce_index_op() {
     let mut i = I(10);
     i[i[3]] = 4;
-    //[nll]~^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    // Shoud be accepted with g2p
 
     i[3] = i[4];
 
     i[i[3]] = i[4];
-    //[nll]~^  ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    //~^ ERROR cannot borrow `i` as immutable because it is also borrowed as mutable [E0502]
+    // Shoud be accepted with g2p
 }
 
 fn main() {