parent
563dc5171f
commit
fbb7df0f82
3 changed files with 44 additions and 14 deletions
|
|
@ -12,17 +12,29 @@
|
|||
// conflicts with a new loan, as opposed to every issued loan. This keeps us
|
||||
// down to O(n) errors (for n problem lines), instead of O(n^2) errors.
|
||||
|
||||
// revisions: ast mir
|
||||
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
|
||||
|
||||
fn main() {
|
||||
let mut x = 1;
|
||||
let mut addr;
|
||||
loop {
|
||||
match 1 {
|
||||
1 => { addr = &mut x; }
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once at a time
|
||||
2 => { addr = &mut x; }
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once at a time
|
||||
_ => { addr = &mut x; }
|
||||
//~^ ERROR cannot borrow `x` as mutable more than once at a time
|
||||
1 => { addr = &mut x; } //[ast]~ ERROR [E0499]
|
||||
//[mir]~^ ERROR (Ast) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
2 => { addr = &mut x; } //[ast]~ ERROR [E0499]
|
||||
//[mir]~^ ERROR (Ast) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
_ => { addr = &mut x; } //[ast]~ ERROR [E0499]
|
||||
//[mir]~^ ERROR (Ast) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// revisions: ast mir
|
||||
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
|
||||
|
||||
enum Sexpression {
|
||||
Num(()),
|
||||
Cons(&'static mut Sexpression)
|
||||
|
|
@ -15,9 +18,18 @@ enum Sexpression {
|
|||
|
||||
fn causes_ice(mut l: &mut Sexpression) {
|
||||
loop { match l {
|
||||
&mut Sexpression::Num(ref mut n) => {},
|
||||
&mut Sexpression::Cons(ref mut expr) => { //~ ERROR cannot borrow `l.0`
|
||||
l = &mut **expr; //~ ERROR cannot assign to `l`
|
||||
&mut Sexpression::Num(ref mut n) => {}, //[mir]~ ERROR (Mir) [E0384]
|
||||
&mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499]
|
||||
//[mir]~^ ERROR (Ast) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0384]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
l = &mut **expr; //[ast]~ ERROR [E0506]
|
||||
//[mir]~^ ERROR (Ast) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0506]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
//[mir]~| ERROR (Mir) [E0499]
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue