@@ -6,9 +6,9 @@ LL | fn f<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
66 | |
77 | lifetime `'a` defined here
88LL | let mut x = foo::<&'a ()>;
9- | ^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
9+ | ^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
1010 |
11- = help: consider adding the following bound: `'b : 'a `
11+ = help: consider adding the following bound: `'a : 'b `
1212 = note: requirement occurs because of a function pointer to `foo`
1313 = note: the function `foo` is invariant over the parameter `T`
1414 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -22,9 +22,9 @@ LL | fn f<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
2222 | lifetime `'a` defined here
2323LL | let mut x = foo::<&'a ()>;
2424LL | x = foo::<&'b ()>;
25- | ^^^^^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
25+ | ^^^^^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
2626 |
27- = help: consider adding the following bound: `'a : 'b `
27+ = help: consider adding the following bound: `'b : 'a `
2828 = note: requirement occurs because of a function pointer to `foo`
2929 = note: the function `foo` is invariant over the parameter `T`
3030 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -53,9 +53,9 @@ LL | fn i<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
5353 | lifetime `'a` defined here
5454LL | let mut x = foo::<&'c ()>;
5555LL | x = foo::<&'b ()>;
56- | ^^^^^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
56+ | ^^^^^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
5757 |
58- = help: consider adding the following bound: `'a : 'b `
58+ = help: consider adding the following bound: `'b : 'a `
5959 = note: requirement occurs because of a function pointer to `foo`
6060 = note: the function `foo` is invariant over the parameter `T`
6161 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -69,9 +69,9 @@ LL | fn i<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
6969 | lifetime `'a` defined here
7070...
7171LL | x = foo::<&'a ()>;
72- | ^^^^^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
72+ | ^^^^^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
7373 |
74- = help: consider adding the following bound: `'b : 'a `
74+ = help: consider adding the following bound: `'a : 'b `
7575 = note: requirement occurs because of a function pointer to `foo`
7676 = note: the function `foo` is invariant over the parameter `T`
7777 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -89,9 +89,9 @@ LL | fn j<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
8989 | lifetime `'a` defined here
9090LL | let x = match true {
9191LL | true => foo::<&'b ()>,
92- | ^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
92+ | ^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
9393 |
94- = help: consider adding the following bound: `'a : 'b `
94+ = help: consider adding the following bound: `'b : 'a `
9595 = note: requirement occurs because of a function pointer to `foo`
9696 = note: the function `foo` is invariant over the parameter `T`
9797 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -105,9 +105,9 @@ LL | fn j<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
105105 | lifetime `'a` defined here
106106...
107107LL | false => foo::<&'a ()>,
108- | ^^^^^^^^^^^^^ assignment requires that `'b ` must outlive `'a `
108+ | ^^^^^^^^^^^^^ assignment requires that `'a ` must outlive `'b `
109109 |
110- = help: consider adding the following bound: `'b : 'a `
110+ = help: consider adding the following bound: `'a : 'b `
111111 = note: requirement occurs because of a function pointer to `foo`
112112 = note: the function `foo` is invariant over the parameter `T`
113113 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
@@ -117,36 +117,33 @@ help: `'a` and `'b` must be the same: replace one with the other
117117 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
118118
119119error: lifetime may not live long enough
120- --> $DIR/fn_def_coercion.rs:49:17
120+ --> $DIR/fn_def_coercion.rs:50:18
121121 |
122122LL | fn k<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
123123 | -- -- lifetime `'c` defined here
124124 | |
125125 | lifetime `'a` defined here
126- LL | let x = match true {
127- LL | true => foo::<&'c ()>,
128- | ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'c`
126+ ...
127+ LL | false => foo::<&'a ()>,
128+ | ^^^^^^^^^^^^^ assignment requires that `'a` must outlive `'c`
129129 |
130130 = help: consider adding the following bound: `'a: 'c`
131131 = note: requirement occurs because of a function pointer to `foo`
132132 = note: the function `foo` is invariant over the parameter `T`
133133 = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
134134
135135error: lifetime may not live long enough
136- --> $DIR/fn_def_coercion.rs:50:18
136+ --> $DIR/fn_def_coercion.rs:54:5
137137 |
138138LL | fn k<'a, 'b, 'c: 'a + 'b>(a: &'a (), b: &'b (), c: &'c ()) {
139139 | -- -- lifetime `'b` defined here
140140 | |
141141 | lifetime `'a` defined here
142142...
143- LL | false => foo::<&'a ()>,
144- | ^^^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
143+ LL | x(b);
144+ | ^^^^ argument requires that `'b` must outlive `'a`
145145 |
146146 = help: consider adding the following bound: `'b: 'a`
147- = note: requirement occurs because of a function pointer to `foo`
148- = note: the function `foo` is invariant over the parameter `T`
149- = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
150147
151148help: the following changes may resolve your lifetime errors
152149 |
0 commit comments