Skip to content

Commit d6caf73

Browse files
committed
Added revisions: ast mir template to tests that this PR sync'ed ast+mir borrowcks.
(There are other tests that this PR also improves, but were not completely synchronized. I chose to wait until later to pull those into the `revisions: ast mir` testing pattern; later being either when they *are* synchronized, or in some PR where we migrate all borrowck tests, regardless of whether MIR-borrowck is "finished" for them or not.)
1 parent b62b67a commit d6caf73

4 files changed

+28
-5
lines changed

src/test/compile-fail/borrowck/borrowck-init-in-fru.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// revisions: ast mir
12+
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13+
1114
#[derive(Clone)]
1215
struct point {
1316
x: isize,
@@ -16,6 +19,9 @@ struct point {
1619

1720
fn main() {
1821
let mut origin: point;
19-
origin = point {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin.y`
22+
origin = point {x: 10,.. origin};
23+
//[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381]
24+
//[mir]~^^ ERROR (Ast) [E0381]
25+
//[mir]~| ERROR (Mir) [E0381]
2026
origin.clone();
2127
}

src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// revisions: ast mir
12+
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13+
1114
fn test() {
1215
let w: &mut [isize];
13-
w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w`
16+
w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
17+
//[mir]~^ ERROR (Ast) [E0381]
18+
//[mir]~| ERROR (Mir) [E0381]
1419

1520
let mut w: &mut [isize];
16-
w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w`
21+
w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
22+
//[mir]~^ ERROR (Ast) [E0381]
23+
//[mir]~| ERROR (Mir) [E0381]
1724
}
1825

1926
fn main() { test(); }

src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// revisions: ast mir
12+
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13+
1114
// Variation on `borrowck-use-uninitialized-in-cast` in which we do a
1215
// trait cast from an uninitialized source. Issue #20791.
1316

@@ -16,5 +19,7 @@ impl Foo for i32 { }
1619

1720
fn main() {
1821
let x: &i32;
19-
let y = x as *const Foo; //~ ERROR use of possibly uninitialized variable: `*x`
22+
let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
23+
//[mir]~^ ERROR (Ast) [E0381]
24+
//[mir]~| ERROR (Mir) [E0381]
2025
}

src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// revisions: ast mir
12+
//[mir]compile-flags: -Z emit-end-regions -Z borrowck-mir
13+
1114
// Check that we detect unused values that are cast to other things.
1215
// The problem was specified to casting to `*`, as creating unsafe
1316
// pointers was not being fully checked. Issue #20791.
1417

1518
fn main() {
1619
let x: &i32;
17-
let y = x as *const i32; //~ ERROR use of possibly uninitialized variable: `*x`
20+
let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
21+
//[mir]~^ ERROR (Ast) [E0381]
22+
//[mir]~| ERROR (Mir) [E0381]
1823
}

0 commit comments

Comments
 (0)