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