From 094d67ee37d37caa2ebd755fa39ebcaa7b586b26 Mon Sep 17 00:00:00 2001 From: Basile Desloges Date: Thu, 16 Nov 2017 16:52:04 +0100 Subject: mir-borrowck: Remove parens in the lvalue description of a deref --- .../compile-fail/borrowck/borrowck-closures-mut-and-imm.rs | 4 ++-- src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs | 10 +++++----- src/test/compile-fail/coerce-overloaded-autoderef.rs | 8 ++++---- src/test/compile-fail/mut-pattern-internal-mutability.rs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/test/compile-fail') diff --git a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs index 0b6b9bf7d48..c40470a927c 100644 --- a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs @@ -70,7 +70,7 @@ fn f() { let c1 = || get(&*x); *x = 5; //[ast]~ ERROR cannot assign //[mir]~^ ERROR cannot assign to `*x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*x)` because it is borrowed (Mir) + //[mir]~| ERROR cannot assign to `*x` because it is borrowed (Mir) } fn g() { @@ -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.f)` because it is borrowed (Mir) + //[mir]~| ERROR cannot assign to `*x.f` because it is borrowed (Mir) } fn h() { diff --git a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs index d1cf08ac754..009819f0bb5 100644 --- a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs +++ b/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs @@ -252,7 +252,7 @@ fn main() { fn bump<'a>(mut block: &mut Block<'a>) { let x = &mut block; let p: &'a u8 = &*block.current; - //[mir]~^ ERROR cannot borrow `(*block.current)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable (Mir) // No errors in AST because of issue rust#38899 } } @@ -266,7 +266,7 @@ fn main() { unsafe fn bump2(mut block: *mut Block2) { let x = &mut block; let p : *const u8 = &*(*block).current; - //[mir]~^ ERROR cannot borrow `(*block.current)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable (Mir) // No errors in AST because of issue rust#38899 } } @@ -279,7 +279,7 @@ fn main() { //[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed //[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed (Ast) //[mir]~| ERROR cannot use `v[..].y` because it was mutably borrowed (Mir) - //[mir]~| ERROR cannot use `(*v)` because it was mutably borrowed (Mir) + //[mir]~| ERROR cannot use `*v` because it was mutably borrowed (Mir) } // Field of constant index { @@ -300,7 +300,7 @@ fn main() { let y = &mut x; &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time //[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir) *y = 1; }; } @@ -312,7 +312,7 @@ fn main() { let y = &mut x; &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time //[mir]~^ ERROR cannot borrow `**x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir) *y = 1; } }; diff --git a/src/test/compile-fail/coerce-overloaded-autoderef.rs b/src/test/compile-fail/coerce-overloaded-autoderef.rs index 43b771ce5db..1060c3f468c 100644 --- a/src/test/compile-fail/coerce-overloaded-autoderef.rs +++ b/src/test/compile-fail/coerce-overloaded-autoderef.rs @@ -22,7 +22,7 @@ fn double_mut_borrow(x: &mut Box) { let z = borrow_mut(x); //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir) } fn double_imm_borrow(x: &mut Box) { @@ -31,21 +31,21 @@ fn double_imm_borrow(x: &mut Box) { **x += 1; //[ast]~^ ERROR cannot assign to `**x` because it is borrowed //[mir]~^^ ERROR cannot assign to `**x` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*(*x))` because it is borrowed (Mir) + //[mir]~| ERROR cannot assign to `**x` because it is borrowed (Mir) } fn double_mut_borrow2(x: &mut Box) { borrow_mut2(x, x); //[ast]~^ ERROR cannot borrow `*x` as mutable more than once at a time //[mir]~^^ ERROR cannot borrow `*x` as mutable more than once at a time (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as mutable more than once at a time (Mir) + //[mir]~| ERROR cannot borrow `*x` as mutable more than once at a time (Mir) } fn double_borrow2(x: &mut Box) { borrow2(x, x); //[ast]~^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable //[mir]~^^ ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable (Ast) - //[mir]~| ERROR cannot borrow `(*x)` as immutable because it is also borrowed as mutable (Mir) + //[mir]~| ERROR cannot borrow `*x` as immutable because it is also borrowed as mutable (Mir) } pub fn main() {} diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/compile-fail/mut-pattern-internal-mutability.rs index 1c7bc9d7303..a1b7a314f21 100644 --- a/src/test/compile-fail/mut-pattern-internal-mutability.rs +++ b/src/test/compile-fail/mut-pattern-internal-mutability.rs @@ -27,5 +27,5 @@ fn main() { let &mut ref x = foo; *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed (Ast) - //[mir]~| ERROR cannot assign to `(*foo)` because it is borrowed (Mir) + //[mir]~| ERROR cannot assign to `*foo` because it is borrowed (Mir) } -- cgit 1.4.1-3-g733a5