Skip to content

Commit 6421432

Browse files
committed
bless region-multiple-lifetime-bounds-on-fns-where-clause under polonius
The diagnostics are either the same or better than NLLs: an error that is seen in the compare-mode, but not visible in the NLL output (probably because of early return in case of error) is visible in the polonius output. A duplicate error is emitted because of a suggestion on the universal regions.
1 parent 42237cc commit 6421432

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
error: lifetime may not live long enough
2+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5
3+
|
4+
LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
5+
| -- -- lifetime `'b` defined here
6+
| |
7+
| lifetime `'a` defined here
8+
LL | // Illegal now because there is no `'b:'a` declaration.
9+
LL | *x = *y;
10+
| ^^^^^^^ assignment requires that `'b` must outlive `'a`
11+
|
12+
= help: consider adding the following bound: `'b: 'a`
13+
14+
error: lifetime may not live long enough
15+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:5
16+
|
17+
LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
18+
| -- -- lifetime `'c` defined here
19+
| |
20+
| lifetime `'b` defined here
21+
...
22+
LL | *z = *y;
23+
| ^^^^^^^ assignment requires that `'b` must outlive `'c`
24+
|
25+
= help: consider adding the following bound: `'b: 'c`
26+
27+
help: add bound `'b: 'a + 'c`
28+
29+
error: lifetime may not live long enough
30+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5
31+
|
32+
LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
33+
| -- -- lifetime `'b` defined here
34+
| |
35+
| lifetime `'a` defined here
36+
...
37+
LL | a(x, y, z);
38+
| ^^^^^^^^^^ argument requires that `'b` must outlive `'a`
39+
|
40+
= help: consider adding the following bound: `'b: 'a`
41+
= note: requirement occurs because of a mutable reference to &isize
42+
= note: mutable references are invariant over their type parameter
43+
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
44+
45+
error: lifetime may not live long enough
46+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5
47+
|
48+
LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
49+
| -- -- lifetime `'c` defined here
50+
| |
51+
| lifetime `'b` defined here
52+
...
53+
LL | a(x, y, z);
54+
| ^^^^^^^^^^ argument requires that `'b` must outlive `'c`
55+
|
56+
= help: consider adding the following bound: `'b: 'c`
57+
= note: requirement occurs because of a mutable reference to &isize
58+
= note: mutable references are invariant over their type parameter
59+
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
60+
61+
help: add bound `'b: 'a + 'c`
62+
63+
error: higher-ranked subtype error
64+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
65+
|
66+
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
67+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
69+
error: higher-ranked subtype error
70+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
71+
|
72+
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
73+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74+
75+
error: higher-ranked subtype error
76+
--> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
77+
|
78+
LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
79+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80+
81+
error: aborting due to 7 previous errors
82+

0 commit comments

Comments
 (0)