Skip to content

Commit 755fa9c

Browse files
committed
Update tests for -Zborrowck-mir -> -Zborrowck=mode migration
1 parent c9af68e commit 755fa9c

File tree

57 files changed

+194
-320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+194
-320
lines changed

Diff for: src/test/compile-fail/E0506.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
struct FancyNum {
1515
num: u8,
@@ -19,8 +19,7 @@ fn main() {
1919
let mut fancy_num = FancyNum { num: 5 };
2020
let fancy_ref = &fancy_num;
2121
fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
22-
//[mir]~^ ERROR (Mir) [E0506]
23-
//[mir]~| ERROR (Ast) [E0506]
22+
//[mir]~^ ERROR [E0506]
2423

2524
println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
2625
}

Diff for: src/test/compile-fail/E0508.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Zborrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
struct NonCopy;
1515

1616
fn main() {
1717
let array = [NonCopy; 1];
18-
let _value = array[0]; //[ast]~ ERROR E0508
19-
//[mir]~^ ERROR (Ast) [E0508]
20-
//[mir]~| ERROR (Mir) [E0508]
18+
let _value = array[0]; //[ast]~ ERROR [E0508]
19+
//[mir]~^ ERROR [E0508]
2120
}

Diff for: src/test/compile-fail/E0594.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
static NUM: i32 = 18;
1515

1616
fn main() {
1717
NUM = 20; //[ast]~ ERROR E0594
18-
//[mir]~^ ERROR cannot assign to immutable static item (Ast)
19-
//[mir]~| ERROR cannot assign to immutable static item `NUM` (Mir)
18+
//[mir]~^ ERROR cannot assign to immutable static item
2019
}

Diff for: src/test/compile-fail/E0596.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
fn main() {
1515
let x = 1;
1616
let y = &mut x; //[ast]~ ERROR [E0596]
17-
//[mir]~^ ERROR (Ast) [E0596]
18-
//[mir]~| ERROR (Mir) [E0596]
17+
//[mir]~^ ERROR [E0596]
1918
}

Diff for: src/test/compile-fail/borrowck/borrowck-access-permissions.rs

+8-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
static static_x : i32 = 1;
1515
static mut static_x_mut : i32 = 1;
@@ -20,15 +20,13 @@ fn main() {
2020

2121
{ // borrow of local
2222
let _y1 = &mut x; //[ast]~ ERROR [E0596]
23-
//[mir]~^ ERROR (Ast) [E0596]
24-
//[mir]~| ERROR (Mir) [E0596]
23+
//[mir]~^ ERROR [E0596]
2524
let _y2 = &mut x_mut; // No error
2625
}
2726

2827
{ // borrow of static
2928
let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
30-
//[mir]~^ ERROR (Ast) [E0596]
31-
//[mir]~| ERROR (Mir) [E0596]
29+
//[mir]~^ ERROR [E0596]
3230
unsafe { let _y2 = &mut static_x_mut; } // No error
3331
}
3432

@@ -37,8 +35,7 @@ fn main() {
3735
let mut box_x_mut = Box::new(1);
3836

3937
let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
40-
//[mir]~^ ERROR (Ast) [E0596]
41-
//[mir]~| ERROR (Mir) [E0596]
38+
//[mir]~^ ERROR [E0596]
4239
let _y2 = &mut *box_x_mut; // No error
4340
}
4441

@@ -47,8 +44,7 @@ fn main() {
4744
let ref_x_mut = &mut x_mut;
4845

4946
let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
50-
//[mir]~^ ERROR (Ast) [E0596]
51-
//[mir]~| ERROR (Mir) [E0596]
47+
//[mir]~^ ERROR [E0596]
5248
let _y2 = &mut *ref_x_mut; // No error
5349
}
5450

@@ -58,8 +54,7 @@ fn main() {
5854

5955
unsafe {
6056
let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
61-
//[mir]~^ ERROR (Ast) [E0596]
62-
//[mir]~| ERROR (Mir) [E0596]
57+
//[mir]~^ ERROR [E0596]
6358
let _y2 = &mut *ptr_mut_x; // No error
6459
}
6560
}
@@ -69,8 +64,7 @@ fn main() {
6964
let mut foo = Foo { f: &mut x_mut, g: &x };
7065
let foo_ref = &foo;
7166
let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
72-
//[mir]~^ ERROR (Ast) [E0389]
73-
//[mir]~| ERROR (Mir) [E0596]
74-
// FIXME: Wrong error in MIR
67+
//[mir]~^ ERROR [E0596]
68+
// FIXME: Wrong error in MIR
7569
}
7670
}

Diff for: src/test/compile-fail/borrowck/borrowck-assign-comp.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
struct point { x: isize, y: isize }
1515

@@ -21,8 +21,7 @@ fn a() {
2121
// inherently mutable; since `p` was made immutable, `p.x` is now
2222
// immutable. Otherwise the type of &_q.x (&isize) would be wrong.
2323
p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
24-
//[mir]~^ ERROR cannot assign to `p.x` because it is borrowed (Ast)
25-
//[mir]~| ERROR cannot assign to `p.x` because it is borrowed (Mir)
24+
//[mir]~^ ERROR cannot assign to `p.x` because it is borrowed
2625
q.x;
2726
}
2827

@@ -33,8 +32,7 @@ fn c() {
3332
let mut p = point {x: 3, y: 4};
3433
let q = &p.y;
3534
p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
36-
//[mir]~^ ERROR cannot assign to `p` because it is borrowed (Ast)
37-
//[mir]~| ERROR cannot assign to `p` because it is borrowed (Mir)
35+
//[mir]~^ ERROR cannot assign to `p` because it is borrowed
3836
p.x; // silence warning
3937
*q; // stretch loan
4038
}
@@ -46,8 +44,7 @@ fn d() {
4644
let mut p = point {x: 3, y: 4};
4745
let q = &p.y;
4846
p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
49-
//[mir]~^ ERROR cannot assign to `p.y` because it is borrowed (Ast)
50-
//[mir]~| ERROR cannot assign to `p.y` because it is borrowed (Mir)
47+
//[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
5148
*q;
5249
}
5350

Diff for: src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
// except according to those terms.
1010

1111
// revisions: ast mir
12-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
12+
//[mir]compile-flags: -Z borrowck=mir
1313

1414
static foo: isize = 5;
1515

1616
fn main() {
1717
// assigning to various global constants
1818
foo = 6; //[ast]~ ERROR cannot assign to immutable static item
19-
//[mir]~^ ERROR cannot assign to immutable static item (Ast)
20-
//[mir]~| ERROR cannot assign to immutable static item `foo` (Mir)
19+
//[mir]~^ ERROR cannot assign to immutable static item `foo`
2120
}

Diff for: src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs

+10-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
// ignore-tidy-linelength
1515
// revisions: ast mir
16-
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
16+
//[mir]compile-flags: -Z borrowck=mir
1717

1818
#![feature(box_syntax)]
1919

@@ -29,48 +29,42 @@ fn a() {
2929
let mut x = 3;
3030
let c1 = || x = 4;
3131
let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
32-
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
33-
//[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
32+
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
3433
}
3534

3635
fn b() {
3736
let mut x = 3;
3837
let c1 = || set(&mut x);
3938
let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
40-
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
41-
//[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
39+
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
4240
}
4341

4442
fn c() {
4543
let mut x = 3;
4644
let c1 = || set(&mut x);
4745
let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
48-
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Ast)
49-
//[mir]~| ERROR cannot borrow `x` as immutable because it is also borrowed as mutable (Mir)
46+
//[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
5047
}
5148

5249
fn d() {
5350
let mut x = 3;
5451
let c2 = || x * 5;
5552
x = 5; //[ast]~ ERROR cannot assign
56-
//[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
57-
//[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
53+
//[mir]~^ ERROR cannot assign to `x` because it is borrowed
5854
}
5955

6056
fn e() {
6157
let mut x = 3;
6258
let c1 = || get(&x);
6359
x = 5; //[ast]~ ERROR cannot assign
64-
//[mir]~^ ERROR cannot assign to `x` because it is borrowed (Ast)
65-
//[mir]~| ERROR cannot assign to `x` because it is borrowed (Mir)
60+
//[mir]~^ ERROR cannot assign to `x` because it is borrowed
6661
}
6762

6863
fn f() {
6964
let mut x: Box<_> = box 3;
7065
let c1 = || get(&*x);
71-
*x = 5; //[ast]~ ERROR cannot assign
72-
//[mir]~^ ERROR cannot assign to `*x` because it is borrowed (Ast)
73-
//[mir]~| ERROR cannot assign to `*x` because it is borrowed (Mir)
66+
*x = 5; //[ast]~ ERROR cannot assign to `*x`
67+
//[mir]~^ ERROR cannot assign to `*x` because it is borrowed
7468
}
7569

7670
fn g() {
@@ -81,8 +75,7 @@ fn g() {
8175
let mut x: Box<_> = box Foo { f: box 3 };
8276
let c1 = || get(&*x.f);
8377
*x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
84-
//[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed (Ast)
85-
//[mir]~| ERROR cannot assign to `*x.f` because it is borrowed (Mir)
78+
//[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed
8679
}
8780

8881
fn h() {
@@ -93,8 +86,7 @@ fn h() {
9386
let mut x: Box<_> = box Foo { f: box 3 };
9487
let c1 = || get(&*x.f);
9588
let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
96-
//[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Ast)
97-
//[mir]~| ERROR cannot borrow `x` as mutable because it is also borrowed as immutable (Mir)
89+
//[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
9890
}
9991

10092
fn main() {

0 commit comments

Comments
 (0)