2017-10-05 07:32:05 -05:00
|
|
|
// revisions: ast mir
|
2017-11-19 16:37:59 -06:00
|
|
|
//[mir]compile-flags: -Z borrowck=mir
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
struct S<X, Y> {
|
|
|
|
x: X,
|
|
|
|
y: Y,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: &&Box<i32>;
|
|
|
|
let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
|
2017-11-19 16:37:59 -06:00
|
|
|
//[mir]~^ [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
let x: &&S<i32, i32>;
|
|
|
|
let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
|
2017-11-19 16:37:59 -06:00
|
|
|
//[mir]~^ [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
let x: &&i32;
|
|
|
|
let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
|
2017-11-19 16:37:59 -06:00
|
|
|
//[mir]~^ [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
let mut a: S<i32, i32>;
|
2018-10-16 10:08:59 -05:00
|
|
|
a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381]
|
2018-10-16 10:08:59 -05:00
|
|
|
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
let mut a: S<&&i32, &&i32>;
|
2018-10-16 10:08:59 -05:00
|
|
|
a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381]
|
2018-10-16 10:08:59 -05:00
|
|
|
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
let mut a: S<i32, i32>;
|
2018-10-16 10:08:59 -05:00
|
|
|
a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
|
2018-10-16 10:08:59 -05:00
|
|
|
|
2017-10-05 07:32:05 -05:00
|
|
|
|
|
|
|
let mut a: S<&&i32, &&i32>;
|
2018-10-16 10:08:59 -05:00
|
|
|
a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381]
|
2017-10-05 07:32:05 -05:00
|
|
|
let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
|
2018-10-16 10:08:59 -05:00
|
|
|
|
2017-10-05 07:32:05 -05:00
|
|
|
}
|