Updated other tests affected by change.

This commit is contained in:
David Wood 2018-01-10 18:00:50 +00:00
parent cad7b4f450
commit 1aa454e1e6
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
11 changed files with 24 additions and 19 deletions

View file

@ -13,7 +13,7 @@ fn bar<F>(blk: F) where F: FnOnce() + 'static {
fn foo(x: &()) {
bar(|| {
//~^ ERROR does not fulfill
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
let _ = x;
})
}

View file

@ -13,7 +13,7 @@
use std::fmt::Debug;
fn elided(x: &i32) -> impl Copy { x }
//~^ ERROR cannot infer an appropriate lifetime
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
fn explicit<'a>(x: &'a i32) -> impl Copy { x }
//~^ ERROR cannot infer an appropriate lifetime

View file

@ -12,7 +12,7 @@ use std::any::Any;
fn foo<T: Any>(value: &T) -> Box<Any> {
Box::new(value) as Box<Any>
//~^ ERROR: cannot infer an appropriate lifetime
//~^ ERROR explicit lifetime required in the type of `value` [E0621]
}
fn main() {

View file

@ -25,7 +25,7 @@ fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
// `Box<SomeTrait>` defaults to a `'static` bound, so this return
// is illegal.
ss.r //~ ERROR cannot infer an appropriate lifetime
ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
}
fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) {

View file

@ -16,20 +16,20 @@ impl<'a> Foo for &'a [u8] {}
fn a(v: &[u8]) -> Box<Foo + 'static> {
let x: Box<Foo + 'static> = Box::new(v);
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
x
}
fn b(v: &[u8]) -> Box<Foo + 'static> {
Box::new(v)
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
}
fn c(v: &[u8]) -> Box<Foo> {
// same as previous case due to RFC 599
Box::new(v)
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
}
fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {

View file

@ -16,7 +16,7 @@ fn borrowed_proc<'a>(x: &'a isize) -> Box<FnMut()->(isize) + 'a> {
fn static_proc(x: &isize) -> Box<FnMut()->(isize) + 'static> {
// This is illegal, because the region bound on `proc` is 'static.
Box::new(move|| { *x }) //~ ERROR cannot infer an appropriate lifetime
Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621]
}
fn main() { }

View file

@ -22,12 +22,12 @@ fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
}
fn error(u: &(), v: &()) {
static_id(&u); //[ll]~ ERROR cannot infer an appropriate lifetime
static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
//[nll]~^ WARNING not reporting region error due to -Znll
//[nll]~| ERROR free region `` does not outlive free region `'static`
static_id_indirect(&v); //[ll]~ ERROR cannot infer an appropriate lifetime
//[nll]~| ERROR explicit lifetime required in the type of `u` [E0621]
static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
//[nll]~^ WARNING not reporting region error due to -Znll
//[nll]~| ERROR free region `` does not outlive free region `'static`
//[nll]~| ERROR explicit lifetime required in the type of `v` [E0621]
}
fn main() {}

View file

@ -18,7 +18,7 @@
fn foo(x: &u32) -> &'static u32 {
&*x
//~^ WARN not reporting region error due to -Znll
//~| ERROR does not outlive free region
//~| ERROR explicit lifetime required in the type of `x`
}
fn main() { }

View file

@ -4,11 +4,13 @@ warning: not reporting region error due to -Znll
19 | &*x
| ^^^
error: free region `ReFree(DefId(0/0:3 ~ region_lbr_anon_does_not_outlive_static[317d]::foo[0]), BrAnon(0))` does not outlive free region `ReStatic`
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
|
18 | fn foo(x: &u32) -> &'static u32 {
| - consider changing the type of `x` to `&ReStatic u32`
19 | &*x
| ^^^
| ^^^ lifetime `ReStatic` required
error: aborting due to previous error

View file

@ -22,7 +22,7 @@ fn foo(s: &mut (i32,)) -> i32 {
fn bar(s: &Box<(i32,)>) -> &'static i32 {
// FIXME(#46983): error message should be better
&s.0 //~ ERROR free region `` does not outlive free region `'static`
&s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
}
fn main() {

View file

@ -7,11 +7,14 @@ error[E0506]: cannot assign to `*s` because it is borrowed
19 | *s = (2,); //~ ERROR cannot assign to `*s`
| ^^^^^^^^^ assignment to borrowed `*s` occurs here
error: free region `` does not outlive free region `'static`
error[E0621]: explicit lifetime required in the type of `s`
--> $DIR/guarantor-issue-46974.rs:25:5
|
25 | &s.0 //~ ERROR free region `` does not outlive free region `'static`
| ^^^^
23 | fn bar(s: &Box<(i32,)>) -> &'static i32 {
| - consider changing the type of `s` to `&'static std::boxed::Box<(i32,)>`
24 | // FIXME(#46983): error message should be better
25 | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
| ^^^^ lifetime `'static` required
error: aborting due to 2 previous errors