mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
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.)
This commit is contained in:
parent
b62b67a732
commit
d6caf737b3
@ -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
|
||||
|
||||
#[derive(Clone)]
|
||||
struct point {
|
||||
x: isize,
|
||||
@ -16,6 +19,9 @@ struct point {
|
||||
|
||||
fn main() {
|
||||
let mut origin: point;
|
||||
origin = point {x: 10,.. origin}; //~ ERROR use of possibly uninitialized variable: `origin.y`
|
||||
origin = point {x: 10,.. origin};
|
||||
//[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381]
|
||||
//[mir]~^^ ERROR (Ast) [E0381]
|
||||
//[mir]~| ERROR (Mir) [E0381]
|
||||
origin.clone();
|
||||
}
|
||||
|
@ -8,12 +8,19 @@
|
||||
// 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
|
||||
|
||||
fn test() {
|
||||
let w: &mut [isize];
|
||||
w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w`
|
||||
w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
|
||||
//[mir]~^ ERROR (Ast) [E0381]
|
||||
//[mir]~| ERROR (Mir) [E0381]
|
||||
|
||||
let mut w: &mut [isize];
|
||||
w[5] = 0; //~ ERROR use of possibly uninitialized variable: `*w`
|
||||
w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
|
||||
//[mir]~^ ERROR (Ast) [E0381]
|
||||
//[mir]~| ERROR (Mir) [E0381]
|
||||
}
|
||||
|
||||
fn main() { test(); }
|
||||
|
@ -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
|
||||
|
||||
// Variation on `borrowck-use-uninitialized-in-cast` in which we do a
|
||||
// trait cast from an uninitialized source. Issue #20791.
|
||||
|
||||
@ -16,5 +19,7 @@ impl Foo for i32 { }
|
||||
|
||||
fn main() {
|
||||
let x: &i32;
|
||||
let y = x as *const Foo; //~ ERROR use of possibly uninitialized variable: `*x`
|
||||
let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
|
||||
//[mir]~^ ERROR (Ast) [E0381]
|
||||
//[mir]~| ERROR (Mir) [E0381]
|
||||
}
|
||||
|
@ -8,11 +8,16 @@
|
||||
// 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
|
||||
|
||||
// Check that we detect unused values that are cast to other things.
|
||||
// The problem was specified to casting to `*`, as creating unsafe
|
||||
// pointers was not being fully checked. Issue #20791.
|
||||
|
||||
fn main() {
|
||||
let x: &i32;
|
||||
let y = x as *const i32; //~ ERROR use of possibly uninitialized variable: `*x`
|
||||
let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
|
||||
//[mir]~^ ERROR (Ast) [E0381]
|
||||
//[mir]~| ERROR (Mir) [E0381]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user