mir-borrowck: Fix existing tests
This commit is contained in:
parent
ff8ea69d8f
commit
7bdf177c8f
3 changed files with 9 additions and 9 deletions
|
|
@ -22,7 +22,7 @@ fn a() {
|
|||
// immutable. Otherwise the type of &_q.x (&isize) would be wrong.
|
||||
p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
|
||||
//[mir]~^ ERROR cannot assign to `p.x` because it is borrowed (Ast)
|
||||
//[mir]~| ERROR cannot assign to `p.0` because it is borrowed (Mir)
|
||||
//[mir]~| ERROR cannot assign to `p.x` because it is borrowed (Mir)
|
||||
q.x;
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ fn d() {
|
|||
let q = &p.y;
|
||||
p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
|
||||
//[mir]~^ ERROR cannot assign to `p.y` because it is borrowed (Ast)
|
||||
//[mir]~| ERROR cannot assign to `p.1` because it is borrowed (Mir)
|
||||
//[mir]~| ERROR cannot assign to `p.y` because it is borrowed (Mir)
|
||||
*q;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ fn g() {
|
|||
let c1 = || get(&*x.f);
|
||||
*x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
|
||||
//[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed (Ast)
|
||||
//[mir]~| ERROR cannot assign to `(*(*x).0)` because it is borrowed (Mir)
|
||||
//[mir]~| ERROR cannot assign to `(*x.f)` because it is borrowed (Mir)
|
||||
}
|
||||
|
||||
fn h() {
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ fn main() {
|
|||
let ra = &u.a;
|
||||
let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
|
||||
//[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable (Ast)
|
||||
//[mir]~| ERROR cannot borrow `u.0` as mutable because it is also borrowed as immutable (Mir)
|
||||
//[mir]~| ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable (Mir)
|
||||
}
|
||||
{
|
||||
let ra = &u.a;
|
||||
u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
|
||||
//[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast)
|
||||
//[mir]~| ERROR cannot assign to `u.0` because it is borrowed (Mir)
|
||||
//[mir]~| ERROR cannot assign to `u.a` because it is borrowed (Mir)
|
||||
}
|
||||
// Imm borrow, other field
|
||||
{
|
||||
|
|
@ -68,25 +68,25 @@ fn main() {
|
|||
let rma = &mut u.a;
|
||||
let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
|
||||
//[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable (Ast)
|
||||
//[mir]~| ERROR cannot borrow `u.0` as immutable because it is also borrowed as mutable (Mir)
|
||||
//[mir]~| ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable (Mir)
|
||||
}
|
||||
{
|
||||
let ra = &mut u.a;
|
||||
let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
|
||||
//[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast)
|
||||
//[mir]~| ERROR cannot use `u.0` because it was mutably borrowed (Mir)
|
||||
//[mir]~| ERROR cannot use `u.a` because it was mutably borrowed (Mir)
|
||||
}
|
||||
{
|
||||
let rma = &mut u.a;
|
||||
let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
|
||||
//[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time (Ast)
|
||||
//[mir]~| ERROR cannot borrow `u.0` as mutable more than once at a time (Mir)
|
||||
//[mir]~| ERROR cannot borrow `u.a` as mutable more than once at a time (Mir)
|
||||
}
|
||||
{
|
||||
let rma = &mut u.a;
|
||||
u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
|
||||
//[mir]~^ ERROR cannot assign to `u.a` because it is borrowed (Ast)
|
||||
//[mir]~| ERROR cannot assign to `u.0` because it is borrowed (Mir)
|
||||
//[mir]~| ERROR cannot assign to `u.a` because it is borrowed (Mir)
|
||||
}
|
||||
// Mut borrow, other field
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue