This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +29
-8
lines changed Expand file tree Collapse file tree 4 files changed +29
-8
lines changed Original file line number Diff line number Diff line change
1
+ error: lifetime may not live long enough
2
+ --> $DIR/issue-16922.rs:4:5
3
+ |
4
+ LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
5
+ | - let's call the lifetime of this reference `'1`
6
+ LL | Box::new(value) as Box<dyn Any>
7
+ | ^^^^^^^^^^^^^^^ cast requires that `'1` must outlive `'static`
8
+
9
+ error: aborting due to previous error
10
+
Original file line number Diff line number Diff line change 1
- error[E0621]: explicit lifetime required in the type of `ss`
1
+ error: lifetime may not live long enough
2
2
--> $DIR/object-lifetime-default-from-box-error.rs:18:5
3
3
|
4
4
LL | fn load(ss: &mut SomeStruct) -> Box<dyn SomeTrait> {
5
- | --------------- help: add explicit lifetime `'static` to the type of `ss`: ` &mut SomeStruct<'static >`
5
+ | -- has type ` &mut SomeStruct<'1 >`
6
6
...
7
7
LL | ss.r
8
- | ^^^^ lifetime `'static` required
8
+ | ^^^^ returning this value requires that `'1` must outlive `'static`
9
9
10
10
error[E0507]: cannot move out of `ss.r` which is behind a mutable reference
11
11
--> $DIR/object-lifetime-default-from-box-error.rs:18:5
Original file line number Diff line number Diff line change @@ -14,17 +14,17 @@ LL | fn b(v: &[u8]) -> Box<dyn Foo + 'static> {
14
14
LL | Box::new(v)
15
15
| ^^^^^^^^^^^ lifetime `'static` required
16
16
17
- error[E0621]: explicit lifetime required in the type of `v`
18
- --> $DIR/region-object-lifetime-in-coercion.rs:21 :5
17
+ error: lifetime may not live long enough
18
+ --> $DIR/region-object-lifetime-in-coercion.rs:20 :5
19
19
|
20
20
LL | fn c(v: &[u8]) -> Box<dyn Foo> {
21
- | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8] `
21
+ | - let's call the lifetime of this reference `'1 `
22
22
...
23
23
LL | Box::new(v)
24
- | ^^^^^^^^^^^ lifetime `'static` required
24
+ | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
25
25
26
26
error: lifetime may not live long enough
27
- --> $DIR/region-object-lifetime-in-coercion.rs:26 :5
27
+ --> $DIR/region-object-lifetime-in-coercion.rs:24 :5
28
28
|
29
29
LL | fn d<'a,'b>(v: &'a [u8]) -> Box<dyn Foo+'b> {
30
30
| -- -- lifetime `'b` defined here
Original file line number Diff line number Diff line change
1
+ error: lifetime may not live long enough
2
+ --> $DIR/dyn-trait-underscore.rs:8:5
3
+ |
4
+ LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
5
+ | - let's call the lifetime of this reference `'1`
6
+ LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
7
+ LL | Box::new(items.iter())
8
+ | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
9
+
10
+ error: aborting due to previous error
11
+
You can’t perform that action at this time.
0 commit comments