11error[E0308]: mismatched types
2- --> $DIR/type-checking-test-4.rs:17 :13
2+ --> $DIR/type-checking-test-4.rs:20 :13
33 |
44LL | let _ = x as &dyn Bar<'static, 'a>; // Error
55 | ^ lifetime mismatch
66 |
77 = note: expected trait object `dyn Bar<'static, 'a>`
88 found trait object `dyn Bar<'static, 'static>`
99note: the lifetime `'a` as defined here...
10- --> $DIR/type-checking-test-4.rs:16 :16
10+ --> $DIR/type-checking-test-4.rs:19 :16
1111 |
1212LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
1313 | ^^
1414 = note: ...does not necessarily outlive the static lifetime
1515
1616error[E0308]: mismatched types
17- --> $DIR/type-checking-test-4.rs:22 :13
17+ --> $DIR/type-checking-test-4.rs:26 :13
1818 |
1919LL | let _ = x as &dyn Bar<'a, 'static>; // Error
2020 | ^ lifetime mismatch
2121 |
2222 = note: expected trait object `dyn Bar<'a, 'static>`
2323 found trait object `dyn Bar<'static, 'static>`
2424note: the lifetime `'a` as defined here...
25- --> $DIR/type-checking-test-4.rs:21 :16
25+ --> $DIR/type-checking-test-4.rs:25 :16
2626 |
2727LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) {
2828 | ^^
2929 = note: ...does not necessarily outlive the static lifetime
3030
3131error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
32- --> $DIR/type-checking-test-4.rs:27 :27
32+ --> $DIR/type-checking-test-4.rs:32 :27
3333 |
3434LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
3535 | ------------ this data with lifetime `'a`...
@@ -42,12 +42,12 @@ LL | y.get_b() // ERROR
4242 | - ...is used here...
4343 |
4444note: ...and is required to live as long as `'static` here
45- --> $DIR/type-checking-test-4.rs:29 :5
45+ --> $DIR/type-checking-test-4.rs:34 :5
4646 |
4747LL | y.get_b() // ERROR
4848 | ^^^^^^^^^
4949note: `'static` lifetime requirement introduced by the return type
50- --> $DIR/type-checking-test-4.rs:26 :48
50+ --> $DIR/type-checking-test-4.rs:31 :48
5151 |
5252LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
5353 | ^^^^^^^ `'static` requirement introduced here
@@ -56,39 +56,39 @@ LL | y.get_b() // ERROR
5656 | --------- because of this returned expression
5757
5858error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
59- --> $DIR/type-checking-test-4.rs:33 :5
59+ --> $DIR/type-checking-test-4.rs:39 :5
6060 |
6161LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
6262 | ------------ this data with lifetime `'a`...
6363LL | <_ as Bar>::get_b(x) // ERROR
6464 | ^^^^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
6565 |
6666note: `'static` lifetime requirement introduced by the return type
67- --> $DIR/type-checking-test-4.rs:32 :48
67+ --> $DIR/type-checking-test-4.rs:38 :48
6868 |
6969LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
7070 | ^^^^^^^ `'static` requirement introduced here
7171LL | <_ as Bar>::get_b(x) // ERROR
7272 | -------------------- because of this returned expression
7373
7474error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
75- --> $DIR/type-checking-test-4.rs:38 :15
75+ --> $DIR/type-checking-test-4.rs:45 :15
7676 |
7777LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
7878 | ------------ this data with lifetime `'a`...
7979LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
8080 | ----------^^------------- ...is used and required to live as long as `'static` here
8181 |
8282note: `'static` lifetime requirement introduced by the return type
83- --> $DIR/type-checking-test-4.rs:37 :48
83+ --> $DIR/type-checking-test-4.rs:44 :48
8484 |
8585LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
8686 | ^^^^^^^ `'static` requirement introduced here
8787LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
8888 | ---------------------------- because of this returned expression
8989
9090error[E0759]: `x` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
91- --> $DIR/type-checking-test-4.rs:43 :27
91+ --> $DIR/type-checking-test-4.rs:51 :27
9292 |
9393LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
9494 | ------------ this data with lifetime `'a`...
@@ -104,12 +104,12 @@ LL | z.get_b() // ERROR
104104 | - ...is used here...
105105 |
106106note: ...and is required to live as long as `'static` here
107- --> $DIR/type-checking-test-4.rs:47 :5
107+ --> $DIR/type-checking-test-4.rs:55 :5
108108 |
109109LL | z.get_b() // ERROR
110110 | ^^^^^^^^^
111111note: `'static` lifetime requirement introduced by the return type
112- --> $DIR/type-checking-test-4.rs:42 :48
112+ --> $DIR/type-checking-test-4.rs:50 :48
113113 |
114114LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
115115 | ^^^^^^^ `'static` requirement introduced here
0 commit comments