]>
Commit | Line | Data |
---|---|---|
94222f64 XL |
1 | error[E0308]: mismatched types |
2 | --> $DIR/type-checking-test-4.rs:17:13 | |
3 | | | |
4 | LL | let _ = x as &dyn Bar<'static, 'a>; // Error | |
5 | | ^ lifetime mismatch | |
6 | | | |
7 | = note: expected trait object `dyn Bar<'static, 'a>` | |
8 | found trait object `dyn Bar<'static, 'static>` | |
c295e0f8 | 9 | note: the lifetime `'a` as defined here... |
94222f64 XL |
10 | --> $DIR/type-checking-test-4.rs:16:16 |
11 | | | |
12 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { | |
13 | | ^^ | |
14 | = note: ...does not necessarily outlive the static lifetime | |
15 | ||
16 | error[E0308]: mismatched types | |
17 | --> $DIR/type-checking-test-4.rs:22:13 | |
18 | | | |
19 | LL | let _ = x as &dyn Bar<'a, 'static>; // Error | |
20 | | ^ lifetime mismatch | |
21 | | | |
22 | = note: expected trait object `dyn Bar<'a, 'static>` | |
23 | found trait object `dyn Bar<'static, 'static>` | |
c295e0f8 | 24 | note: the lifetime `'a` as defined here... |
94222f64 XL |
25 | --> $DIR/type-checking-test-4.rs:21:16 |
26 | | | |
27 | LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) { | |
28 | | ^^ | |
29 | = note: ...does not necessarily outlive the static lifetime | |
30 | ||
31 | error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement | |
32 | --> $DIR/type-checking-test-4.rs:27:27 | |
33 | | | |
34 | LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> { | |
35 | | ------------ this data with lifetime `'a`... | |
36 | LL | let y = x as &dyn Bar<'_, '_>; | |
37 | | - ^^ | |
38 | | | | |
39 | | ...is captured here... | |
40 | LL | | |
41 | LL | y.get_b() // ERROR | |
42 | | --------- ...and is required to live as long as `'static` here | |
43 | ||
44 | error: aborting due to 3 previous errors | |
45 | ||
46 | Some errors have detailed explanations: E0308, E0759. | |
47 | For more information about an error, try `rustc --explain E0308`. |