Updated existing tests with new error messages.

This commit is contained in:
David Wood 2017-12-11 17:29:31 +00:00
parent 00c7a3f4dc
commit 3dbc11bc63
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
12 changed files with 57 additions and 46 deletions

View file

@ -12,8 +12,9 @@
//[mir]compile-flags: -Z borrowck=mir
fn cplusplus_mode(x: isize) -> &'static isize {
&x //[ast]~ ERROR `x` does not live long enough
&x
//[ast]~^ ERROR `x` does not live long enough [E0597]
//[mir]~^^ ERROR `x` does not live long enough [E0597]
}
//[mir]~^ ERROR borrowed value does not live long enough
fn main() {}

View file

@ -13,10 +13,11 @@
fn cplusplus_mode_exceptionally_unsafe(x: &mut Option<&'static mut isize>) {
let mut z = (0, 0);
*x = Some(&mut z.1); //[ast]~ ERROR [E0597]
*x = Some(&mut z.1);
//[ast]~^ ERROR `z.1` does not live long enough [E0597]
//[mir]~^^ ERROR `z.1` does not live long enough [E0597]
panic!("catch me for a dangling pointer!")
}
//[mir]~^ ERROR [E0597]
fn main() {
cplusplus_mode_exceptionally_unsafe(&mut None);

View file

@ -18,12 +18,16 @@ static FOO: u8 = 3;
fn main() {
let a = &FOO;
//[ast]~^ ERROR borrowed value does not live long enough
//[mir]~^ ERROR `FOO` does not live long enough [E0597]
//[mir]~| does not live long enough
//[mir]~| NOTE borrowed value must be valid for the static lifetime
//[ast]~^^^^ ERROR borrowed value does not live long enough
//[ast]~| does not live long enough
//[ast]~| NOTE borrowed value must be valid for the static lifetime
std::thread::spawn(move || {
println!("{}", a);
});
} //[ast]~ temporary value only lives until here
//[mir]~^ ERROR borrowed value does not live long enough
}
//[mir]~^ borrowed value only lives until here
//[ast]~^^ temporary value only lives until here

View file

@ -82,8 +82,8 @@ fn main() {
//[ast]~^ ERROR `x` does not live long enough
//[ast]~| ERROR `y` does not live long enough
});
//[mir]~^ ERROR borrowed value does not live long enough
//[mir]~| ERROR borrowed value does not live long enough
//[mir]~^ ERROR `x` does not live long enough
//[mir]~| ERROR `y` does not live long enough
w.handle(); // This works
// w.handle_ref(); // This doesn't