Do not registor borrows for unsafe lvalues
This commit is contained in:
parent
3be597acf3
commit
c9d1db7bc5
2 changed files with 50 additions and 42 deletions
|
|
@ -46,12 +46,6 @@ impl Baz {
|
|||
}
|
||||
}
|
||||
|
||||
static mut sfoo : Foo = Foo{x: 23 };
|
||||
static mut sbar : Bar = Bar(23);
|
||||
static mut stuple : (i32, i32) = (24, 25);
|
||||
static mut senum : Baz = Baz::X(26);
|
||||
static mut sunion : U = U { a: 0 };
|
||||
|
||||
fn main() {
|
||||
// Local and field from struct
|
||||
{
|
||||
|
|
@ -96,34 +90,6 @@ fn main() {
|
|||
//[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed (Ast)
|
||||
//[mir]~| ERROR cannot use `u.a` because it was mutably borrowed (Mir)
|
||||
}
|
||||
// Static and field from struct
|
||||
unsafe {
|
||||
let _x = sfoo.x();
|
||||
sfoo.x; //[mir]~ ERROR cannot use `sfoo.x` because it was mutably borrowed (Mir)
|
||||
}
|
||||
// Static and field from tuple-struct
|
||||
unsafe {
|
||||
let _0 = sbar.x();
|
||||
sbar.0; //[mir]~ ERROR cannot use `sbar.0` because it was mutably borrowed (Mir)
|
||||
}
|
||||
// Static and field from tuple
|
||||
unsafe {
|
||||
let _0 = &mut stuple.0;
|
||||
stuple.0; //[mir]~ ERROR cannot use `stuple.0` because it was mutably borrowed (Mir)
|
||||
}
|
||||
// Static and field from enum
|
||||
unsafe {
|
||||
let _e0 = senum.x();
|
||||
match senum {
|
||||
Baz::X(value) => value
|
||||
//[mir]~^ ERROR cannot use `senum.0` because it was mutably borrowed (Mir)
|
||||
};
|
||||
}
|
||||
// Static and field from union
|
||||
unsafe {
|
||||
let _ra = &mut sunion.a;
|
||||
sunion.a; //[mir]~ ERROR cannot use `sunion.a` because it was mutably borrowed (Mir)
|
||||
}
|
||||
// Deref and field from struct
|
||||
{
|
||||
let mut f = Box::new(Foo { x: 22 });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue