Skip to content

Commit 1aa454e

Browse files
committed
Updated other tests affected by change.
1 parent cad7b4f commit 1aa454e

11 files changed

+24
-19
lines changed

src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn bar<F>(blk: F) where F: FnOnce() + 'static {
1313

1414
fn foo(x: &()) {
1515
bar(|| {
16-
//~^ ERROR does not fulfill
16+
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
1717
let _ = x;
1818
})
1919
}

src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use std::fmt::Debug;
1414

1515
fn elided(x: &i32) -> impl Copy { x }
16-
//~^ ERROR cannot infer an appropriate lifetime
16+
//~^ ERROR explicit lifetime required in the type of `x` [E0621]
1717

1818
fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919
//~^ ERROR cannot infer an appropriate lifetime

src/test/compile-fail/issue-16922.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::any::Any;
1212

1313
fn foo<T: Any>(value: &T) -> Box<Any> {
1414
Box::new(value) as Box<Any>
15-
//~^ ERROR: cannot infer an appropriate lifetime
15+
//~^ ERROR explicit lifetime required in the type of `value` [E0621]
1616
}
1717

1818
fn main() {

src/test/compile-fail/object-lifetime-default-from-box-error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
2525
// `Box<SomeTrait>` defaults to a `'static` bound, so this return
2626
// is illegal.
2727

28-
ss.r //~ ERROR cannot infer an appropriate lifetime
28+
ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
2929
}
3030

3131
fn store(ss: &mut SomeStruct, b: Box<SomeTrait>) {

src/test/compile-fail/region-object-lifetime-in-coercion.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ impl<'a> Foo for &'a [u8] {}
1616

1717
fn a(v: &[u8]) -> Box<Foo + 'static> {
1818
let x: Box<Foo + 'static> = Box::new(v);
19-
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
19+
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
2020
x
2121
}
2222

2323
fn b(v: &[u8]) -> Box<Foo + 'static> {
2424
Box::new(v)
25-
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
25+
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
2626
}
2727

2828
fn c(v: &[u8]) -> Box<Foo> {
2929
// same as previous case due to RFC 599
3030

3131
Box::new(v)
32-
//~^ ERROR cannot infer an appropriate lifetime due to conflicting
32+
//~^ ERROR explicit lifetime required in the type of `v` [E0621]
3333
}
3434

3535
fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {

src/test/compile-fail/regions-proc-bound-capture.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn borrowed_proc<'a>(x: &'a isize) -> Box<FnMut()->(isize) + 'a> {
1616

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

2222
fn main() { }

src/test/compile-fail/regions-static-bound.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
2222
}
2323

2424
fn error(u: &(), v: &()) {
25-
static_id(&u); //[ll]~ ERROR cannot infer an appropriate lifetime
25+
static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
2626
//[nll]~^ WARNING not reporting region error due to -Znll
27-
//[nll]~| ERROR free region `` does not outlive free region `'static`
28-
static_id_indirect(&v); //[ll]~ ERROR cannot infer an appropriate lifetime
27+
//[nll]~| ERROR explicit lifetime required in the type of `u` [E0621]
28+
static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
2929
//[nll]~^ WARNING not reporting region error due to -Znll
30-
//[nll]~| ERROR free region `` does not outlive free region `'static`
30+
//[nll]~| ERROR explicit lifetime required in the type of `v` [E0621]
3131
}
3232

3333
fn main() {}

src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
fn foo(x: &u32) -> &'static u32 {
1919
&*x
2020
//~^ WARN not reporting region error due to -Znll
21-
//~| ERROR does not outlive free region
21+
//~| ERROR explicit lifetime required in the type of `x`
2222
}
2323

2424
fn main() { }

src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ warning: not reporting region error due to -Znll
44
19 | &*x
55
| ^^^
66

7-
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`
7+
error[E0621]: explicit lifetime required in the type of `x`
88
--> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5
99
|
10+
18 | fn foo(x: &u32) -> &'static u32 {
11+
| - consider changing the type of `x` to `&ReStatic u32`
1012
19 | &*x
11-
| ^^^
13+
| ^^^ lifetime `ReStatic` required
1214

1315
error: aborting due to previous error
1416

src/test/ui/nll/guarantor-issue-46974.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn foo(s: &mut (i32,)) -> i32 {
2222

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

2828
fn main() {

src/test/ui/nll/guarantor-issue-46974.stderr

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ error[E0506]: cannot assign to `*s` because it is borrowed
77
19 | *s = (2,); //~ ERROR cannot assign to `*s`
88
| ^^^^^^^^^ assignment to borrowed `*s` occurs here
99

10-
error: free region `` does not outlive free region `'static`
10+
error[E0621]: explicit lifetime required in the type of `s`
1111
--> $DIR/guarantor-issue-46974.rs:25:5
1212
|
13-
25 | &s.0 //~ ERROR free region `` does not outlive free region `'static`
14-
| ^^^^
13+
23 | fn bar(s: &Box<(i32,)>) -> &'static i32 {
14+
| - consider changing the type of `s` to `&'static std::boxed::Box<(i32,)>`
15+
24 | // FIXME(#46983): error message should be better
16+
25 | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621]
17+
| ^^^^ lifetime `'static` required
1518

1619
error: aborting due to 2 previous errors
1720

0 commit comments

Comments
 (0)