about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-28 06:35:34 +0000
committerMichael Goulet <michael@errs.io>2022-12-28 18:09:27 +0000
commit01d784131f0a11d19d0ab5398b00ca6bbfd283b1 (patch)
tree6ad2a50282b179732cce8eaf4505b426cabe38c6 /src/test
parent83a28ef095ba4179a63196f16eadd97f110d6cb3 (diff)
downloadrust-01d784131f0a11d19d0ab5398b00ca6bbfd283b1.tar.gz
rust-01d784131f0a11d19d0ab5398b00ca6bbfd283b1.zip
Make trait/impl where clause mismatch on region error a bit more actionable
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/compare-method/region-extra-2.stderr5
-rw-r--r--src/test/ui/compare-method/region-extra.stderr6
-rw-r--r--src/test/ui/generic-associated-types/impl_bounds.stderr5
-rw-r--r--src/test/ui/generic-associated-types/issue-90014.stderr6
-rw-r--r--src/test/ui/generic-associated-types/issue-91883.stderr6
-rw-r--r--src/test/ui/generic-associated-types/issue-92033.stderr6
-rw-r--r--src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr6
7 files changed, 37 insertions, 3 deletions
diff --git a/src/test/ui/compare-method/region-extra-2.stderr b/src/test/ui/compare-method/region-extra-2.stderr
index f01d7f4710c..eb19d57ab05 100644
--- a/src/test/ui/compare-method/region-extra-2.stderr
+++ b/src/test/ui/compare-method/region-extra-2.stderr
@@ -6,6 +6,11 @@ LL |     fn renew<'b: 'a>(self) -> &'b mut [T];
 ...
 LL |     fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
    |                                                     ^^ impl has extra requirement `'a: 'b`
+   |
+help: copy the `where` clause predicates from the trait
+   |
+LL |     fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a {
+   |                                           ~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr
index 4a3af65e904..1a471e18d9d 100644
--- a/src/test/ui/compare-method/region-extra.stderr
+++ b/src/test/ui/compare-method/region-extra.stderr
@@ -6,6 +6,12 @@ LL |     fn foo();
 ...
 LL |     fn foo() where 'a: 'b { }
    |                        ^^ impl has extra requirement `'a: 'b`
+   |
+help: remove the `where` clause
+   |
+LL -     fn foo() where 'a: 'b { }
+LL +     fn foo()  { }
+   |
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr
index 3acd85c8ac6..3456b345cc2 100644
--- a/src/test/ui/generic-associated-types/impl_bounds.stderr
+++ b/src/test/ui/generic-associated-types/impl_bounds.stderr
@@ -15,6 +15,11 @@ LL |     type B<'a, 'b> where 'a: 'b;
 ...
 LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
    |                                                ^^ impl has extra requirement `'b: 'a`
+   |
+help: copy the `where` clause predicates from the trait
+   |
+LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b;
+   |                                      ~~~~~~~~~~~~
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
   --> $DIR/impl_bounds.rs:18:33
diff --git a/src/test/ui/generic-associated-types/issue-90014.stderr b/src/test/ui/generic-associated-types/issue-90014.stderr
index 2d3f4a6af7e..b4b1bc7da7f 100644
--- a/src/test/ui/generic-associated-types/issue-90014.stderr
+++ b/src/test/ui/generic-associated-types/issue-90014.stderr
@@ -5,13 +5,17 @@ LL |     type Fut<'a> where Self: 'a;
    |     ------------ definition of `Fut` from trait
 ...
 LL |     type Fut<'a> = impl Future<Output = ()>;
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a`
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: type must outlive the lifetime `'a` as defined here
   --> $DIR/issue-90014.rs:13:14
    |
 LL |     type Fut<'a> = impl Future<Output = ()>;
    |              ^^
+help: copy the `where` clause predicates from the trait
+   |
+LL |     type Fut<'a> = impl Future<Output = ()> where Self: 'a;
+   |                                             ++++++++++++++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/issue-91883.stderr b/src/test/ui/generic-associated-types/issue-91883.stderr
index 1cfc2aaf161..d5db962094c 100644
--- a/src/test/ui/generic-associated-types/issue-91883.stderr
+++ b/src/test/ui/generic-associated-types/issue-91883.stderr
@@ -5,7 +5,7 @@ LL |     type Cursor<'tx>: Cursor<'tx>
    |     ----------------------------- definition of `Cursor` from trait
 ...
 LL |     type Cursor<'tx> = CursorImpl<'tx>;
-   |                        ^^^^^^^^^^^^^^^- help: try copying these clauses from the trait: `where 'db: 'tx, Self: 'tx`
+   |                        ^^^^^^^^^^^^^^^
    |
 note: lifetime parameter instantiated with the lifetime `'db` as defined here
   --> $DIR/issue-91883.rs:29:6
@@ -17,6 +17,10 @@ note: but lifetime parameter must outlive the lifetime `'tx` as defined here
    |
 LL |     type Cursor<'tx> = CursorImpl<'tx>;
    |                 ^^^
+help: copy the `where` clause predicates from the trait
+   |
+LL |     type Cursor<'tx> = CursorImpl<'tx> where 'db: 'tx, Self: 'tx;
+   |                                        +++++++++++++++++++++++++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/issue-92033.stderr b/src/test/ui/generic-associated-types/issue-92033.stderr
index cd7eed25421..ddc420a7b4e 100644
--- a/src/test/ui/generic-associated-types/issue-92033.stderr
+++ b/src/test/ui/generic-associated-types/issue-92033.stderr
@@ -5,13 +5,17 @@ LL |     type TextureIter<'a>: Iterator<Item = &'a Texture>
    |     -------------------------------------------------- definition of `TextureIter` from trait
 ...
 LL |     type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
-   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try copying this clause from the trait: `where Self: 'a`
+   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: type must outlive the lifetime `'a` as defined here
   --> $DIR/issue-92033.rs:20:22
    |
 LL |     type TextureIter<'a> = std::option::IntoIter<&'a Texture>;
    |                      ^^
+help: copy the `where` clause predicates from the trait
+   |
+LL |     type TextureIter<'a> = std::option::IntoIter<&'a Texture> where Self: 'a;
+   |                                                               ++++++++++++++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
index ffdba6676bf..8a71fc73a9d 100644
--- a/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
+++ b/src/test/ui/generic-associated-types/missing-where-clause-on-trait.stderr
@@ -6,6 +6,12 @@ LL |     type Assoc<'a, 'b>;
 ...
 LL |     type Assoc<'a, 'b> = () where 'a: 'b;
    |                                       ^^ impl has extra requirement `'a: 'b`
+   |
+help: remove the `where` clause
+   |
+LL -     type Assoc<'a, 'b> = () where 'a: 'b;
+LL +     type Assoc<'a, 'b> = () ;
+   |
 
 error: aborting due to previous error