]>
Commit | Line | Data |
---|---|---|
923072b8 | 1 | error: lifetime may not live long enough |
487cf647 | 2 | --> $DIR/type-checking-test-4.rs:15:13 |
94222f64 XL |
3 | | |
4 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { | |
923072b8 FG |
5 | | -- lifetime `'a` defined here |
6 | LL | let _ = x as &dyn Bar<'static, 'a>; // Error | |
7 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` | |
94222f64 | 8 | |
923072b8 | 9 | error: lifetime may not live long enough |
487cf647 | 10 | --> $DIR/type-checking-test-4.rs:20:13 |
94222f64 XL |
11 | | |
12 | LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) { | |
923072b8 FG |
13 | | -- lifetime `'a` defined here |
14 | LL | let _ = x as &dyn Bar<'a, 'static>; // Error | |
15 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` | |
94222f64 | 16 | |
923072b8 | 17 | error: lifetime may not live long enough |
487cf647 | 18 | --> $DIR/type-checking-test-4.rs:26:5 |
94222f64 XL |
19 | | |
20 | LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | |
923072b8 | 21 | | -- lifetime `'a` defined here |
94222f64 | 22 | LL | let y = x as &dyn Bar<'_, '_>; |
a2a8927a | 23 | LL | y.get_b() // ERROR |
923072b8 | 24 | | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` |
a2a8927a | 25 | |
923072b8 | 26 | error: lifetime may not live long enough |
487cf647 | 27 | --> $DIR/type-checking-test-4.rs:31:5 |
a2a8927a XL |
28 | | |
29 | LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | |
923072b8 | 30 | | -- lifetime `'a` defined here |
a2a8927a | 31 | LL | <_ as Bar>::get_b(x) // ERROR |
923072b8 | 32 | | ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` |
a2a8927a | 33 | |
923072b8 | 34 | error: lifetime may not live long enough |
487cf647 | 35 | --> $DIR/type-checking-test-4.rs:36:5 |
a2a8927a XL |
36 | | |
37 | LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | |
923072b8 | 38 | | -- lifetime `'a` defined here |
a2a8927a | 39 | LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR |
923072b8 | 40 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` |
a2a8927a | 41 | |
923072b8 | 42 | error: lifetime may not live long enough |
487cf647 | 43 | --> $DIR/type-checking-test-4.rs:44:5 |
a2a8927a XL |
44 | | |
45 | LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | |
923072b8 | 46 | | -- lifetime `'a` defined here |
a2a8927a XL |
47 | ... |
48 | LL | z.get_b() // ERROR | |
923072b8 | 49 | | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` |
94222f64 | 50 | |
a2a8927a | 51 | error: aborting due to 6 previous errors |
94222f64 | 52 |