]> git.lizzy.rs Git - rust.git/blob - tests/ui/traits/trait-upcasting/type-checking-test-4.stderr
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
[rust.git] / tests / ui / traits / trait-upcasting / type-checking-test-4.stderr
1 error: lifetime may not live long enough
2   --> $DIR/type-checking-test-4.rs:15:13
3    |
4 LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
5    |                -- lifetime `'a` defined here
6 LL |     let _ = x as &dyn Bar<'static, 'a>; // Error
7    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
8
9 error: lifetime may not live long enough
10   --> $DIR/type-checking-test-4.rs:20:13
11    |
12 LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) {
13    |                -- lifetime `'a` defined here
14 LL |     let _ = x as &dyn Bar<'a, 'static>; // Error
15    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static`
16
17 error: lifetime may not live long enough
18   --> $DIR/type-checking-test-4.rs:26:5
19    |
20 LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
21    |                -- lifetime `'a` defined here
22 LL |     let y = x as &dyn Bar<'_, '_>;
23 LL |     y.get_b() // ERROR
24    |     ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
25
26 error: lifetime may not live long enough
27   --> $DIR/type-checking-test-4.rs:31:5
28    |
29 LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
30    |                -- lifetime `'a` defined here
31 LL |     <_ as Bar>::get_b(x) // ERROR
32    |     ^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
33
34 error: lifetime may not live long enough
35   --> $DIR/type-checking-test-4.rs:36:5
36    |
37 LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
38    |                -- lifetime `'a` defined here
39 LL |     <_ as Bar<'_, '_>>::get_b(x) // ERROR
40    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
41
42 error: lifetime may not live long enough
43   --> $DIR/type-checking-test-4.rs:44:5
44    |
45 LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
46    |                -- lifetime `'a` defined here
47 ...
48 LL |     z.get_b() // ERROR
49    |     ^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
50
51 error: aborting due to 6 previous errors
52