Skip to content

Commit 7bdb6fe

Browse files
committed
Apply structured suggestion that allows test to work since 1.64
Close #73497.
1 parent dd91aba commit 7bdb6fe

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

tests/ui/issues/issue-16922.fixed

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// run-rustfix
2+
use std::any::Any;
3+
4+
fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
5+
Box::new(value) as Box<dyn Any>
6+
//~^ ERROR lifetime may not live long enough
7+
}
8+
9+
fn main() {
10+
let _ = foo(&5);
11+
}

tests/ui/issues/issue-16922.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// run-rustfix
12
use std::any::Any;
23

34
fn foo<T: Any>(value: &T) -> Box<dyn Any> {

tests/ui/issues/issue-16922.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/issue-16922.rs:4:5
2+
--> $DIR/issue-16922.rs:5:5
33
|
44
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
55
| - let's call the lifetime of this reference `'1`

0 commit comments

Comments
 (0)