2020-06-06 10:31:51 +00:00
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:5
|
|
|
|
|
|
|
|
|
LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
LL | // Illegal now because there is no `'b:'a` declaration.
|
|
|
|
LL | *x = *y;
|
|
|
|
| ^^^^^^^ assignment requires that `'b` must outlive `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
|
|
|
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:5
|
|
|
|
|
|
|
|
|
LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
|
|
|
|
| -- -- lifetime `'b` defined here
|
|
|
|
| |
|
|
|
|
| lifetime `'a` defined here
|
|
|
|
...
|
|
|
|
LL | a(x, y);
|
|
|
|
| ^^^^^^^ argument requires that `'b` must outlive `'a`
|
|
|
|
|
|
|
|
|
= help: consider adding the following bound: `'b: 'a`
|
2021-05-13 09:30:14 -04:00
|
|
|
= note: requirement occurs because of a mutable reference to &isize
|
|
|
|
= note: mutable references are invariant over their type parameter
|
|
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
2020-06-06 10:31:51 +00:00
|
|
|
|
|
|
|
error: higher-ranked subtype error
|
|
|
|
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12
|
2019-01-27 11:03:21 +00:00
|
|
|
|
|
|
|
|
LL | let _: fn(&mut &isize, &mut &isize) = a;
|
2020-06-06 10:31:51 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: higher-ranked subtype error
|
|
|
|
--> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:12
|
2019-01-27 11:03:21 +00:00
|
|
|
|
|
2020-06-06 10:31:51 +00:00
|
|
|
LL | let _: fn(&mut &isize, &mut &isize) = a;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2019-01-27 11:03:21 +00:00
|
|
|
|
2020-06-06 10:31:51 +00:00
|
|
|
error: aborting due to 4 previous errors
|
2019-01-27 11:03:21 +00:00
|
|
|
|