about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2021-08-03 19:31:36 +0200
committerRémy Rakic <remy.rakic+github@gmail.com>2021-08-03 20:30:10 +0200
commit6421432d47b9aff551c77726234dc09fd52db084 (patch)
treec13f776fc1883cf322c7a56b6cf364af5b94103e /src
parent42237cc8976e38d08e4d325a024b9cf5f819bf55 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr
new file mode 100644
index 00000000000..13741664ef2
--- /dev/null
+++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.polonius.stderr
@@ -0,0 +1,82 @@
+error: lifetime may not live long enough
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:5
+   |
+LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c 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-multiple-lifetime-bounds-on-fns-where-clause.rs:10:5
+   |
+LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+   |          --  -- lifetime `'c` defined here
+   |          |
+   |          lifetime `'b` defined here
+...
+LL |     *z = *y;
+   |     ^^^^^^^ assignment requires that `'b` must outlive `'c`
+   |
+   = help: consider adding the following bound: `'b: 'c`
+
+help: add bound `'b: 'a + 'c`
+
+error: lifetime may not live long enough
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5
+   |
+LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+   |      -- -- lifetime `'b` defined here
+   |      |
+   |      lifetime `'a` defined here
+...
+LL |     a(x, y, z);
+   |     ^^^^^^^^^^ argument requires that `'b` must outlive `'a`
+   |
+   = help: consider adding the following bound: `'b: 'a`
+   = 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
+
+error: lifetime may not live long enough
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:5
+   |
+LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+   |         --  -- lifetime `'c` defined here
+   |         |
+   |         lifetime `'b` defined here
+...
+LL |     a(x, y, z);
+   |     ^^^^^^^^^^ argument requires that `'b` must outlive `'c`
+   |
+   = help: consider adding the following bound: `'b: 'c`
+   = 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
+
+help: add bound `'b: 'a + 'c`
+
+error: higher-ranked subtype error
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
+   |
+LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
+   |
+LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: higher-ranked subtype error
+  --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:12
+   |
+LL |     let _: fn(&mut &isize, &mut &isize, &mut &isize) = a;
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+