1
1
error[E0308]: mismatched types
2
- --> $DIR/type-checking-test-4.rs:17 :13
2
+ --> $DIR/type-checking-test-4.rs:20 :13
3
3
|
4
4
LL | let _ = x as &dyn Bar<'static, 'a>; // Error
5
5
| ^ lifetime mismatch
6
6
|
7
7
= note: expected trait object `dyn Bar<'static, 'a>`
8
8
found trait object `dyn Bar<'static, 'static>`
9
9
note: the lifetime `'a` as defined here...
10
- --> $DIR/type-checking-test-4.rs:16 :16
10
+ --> $DIR/type-checking-test-4.rs:19 :16
11
11
|
12
12
LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) {
13
13
| ^^
14
14
= note: ...does not necessarily outlive the static lifetime
15
15
16
16
error[E0308]: mismatched types
17
- --> $DIR/type-checking-test-4.rs:22 :13
17
+ --> $DIR/type-checking-test-4.rs:26 :13
18
18
|
19
19
LL | let _ = x as &dyn Bar<'a, 'static>; // Error
20
20
| ^ lifetime mismatch
21
21
|
22
22
= note: expected trait object `dyn Bar<'a, 'static>`
23
23
found trait object `dyn Bar<'static, 'static>`
24
24
note: the lifetime `'a` as defined here...
25
- --> $DIR/type-checking-test-4.rs:21 :16
25
+ --> $DIR/type-checking-test-4.rs:25 :16
26
26
|
27
27
LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) {
28
28
| ^^
29
29
= note: ...does not necessarily outlive the static lifetime
30
30
31
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
32
+ --> $DIR/type-checking-test-4.rs:32 :27
33
33
|
34
34
LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
35
35
| ------------ this data with lifetime `'a`...
@@ -42,12 +42,12 @@ LL | y.get_b() // ERROR
42
42
| - ...is used here...
43
43
|
44
44
note: ...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
46
46
|
47
47
LL | y.get_b() // ERROR
48
48
| ^^^^^^^^^
49
49
note: `'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
51
51
|
52
52
LL | fn test_wrong3<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
53
53
| ^^^^^^^ `'static` requirement introduced here
@@ -56,39 +56,39 @@ LL | y.get_b() // ERROR
56
56
| --------- because of this returned expression
57
57
58
58
error[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
60
60
|
61
61
LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
62
62
| ------------ this data with lifetime `'a`...
63
63
LL | <_ as Bar>::get_b(x) // ERROR
64
64
| ^^^^^^^^^^^^^^^^^ ...is used and required to live as long as `'static` here
65
65
|
66
66
note: `'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
68
68
|
69
69
LL | fn test_wrong4<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
70
70
| ^^^^^^^ `'static` requirement introduced here
71
71
LL | <_ as Bar>::get_b(x) // ERROR
72
72
| -------------------- because of this returned expression
73
73
74
74
error[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
76
76
|
77
77
LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
78
78
| ------------ this data with lifetime `'a`...
79
79
LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
80
80
| ----------^^------------- ...is used and required to live as long as `'static` here
81
81
|
82
82
note: `'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
84
84
|
85
85
LL | fn test_wrong5<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
86
86
| ^^^^^^^ `'static` requirement introduced here
87
87
LL | <_ as Bar<'_, '_>>::get_b(x) // ERROR
88
88
| ---------------------------- because of this returned expression
89
89
90
90
error[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
92
92
|
93
93
LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
94
94
| ------------ this data with lifetime `'a`...
@@ -104,12 +104,12 @@ LL | z.get_b() // ERROR
104
104
| - ...is used here...
105
105
|
106
106
note: ...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
108
108
|
109
109
LL | z.get_b() // ERROR
110
110
| ^^^^^^^^^
111
111
note: `'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
113
113
|
114
114
LL | fn test_wrong6<'a>(x: &dyn Foo<'a>) -> Option<&'static u32> {
115
115
| ^^^^^^^ `'static` requirement introduced here
0 commit comments