Auto merge of #106129 - compiler-errors:compare_method-tweaks, r=BoxyUwU

Some `compare_method` tweaks

1. Make some of the comparison functions' names more regular
2. Reduce pub scope of some of the things in `compare_method`
~3. Remove some unnecessary opaque type handling code -- `InferCtxt` already is in a mode that doesn't define opaque types~
  * moved to a different PR
4. Bubble up `ErrorGuaranteed` for region constraint errors in `compare_method` - Improves a redundant error message in one unit test.
5. Move the `compare_method` module to have a more general name, since it's more like `compare_impl_item` :)
6. Rename `collect_trait_impl_trait_tys`
This commit is contained in:
bors 2022-12-28 13:07:30 +00:00
commit 83a28ef095
17 changed files with 89 additions and 72 deletions

View file

@ -15,7 +15,6 @@ impl<T> Foo for Fooy<T> {
//~^ ERROR impl has stricter requirements than trait
type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
//~^ ERROR impl has stricter requirements than trait
//~| ERROR lifetime bound not satisfied
type C = String where Self: Copy;
//~^ ERROR the trait bound `T: Copy` is not satisfied
fn d() where Self: Copy {}

View file

@ -16,28 +16,8 @@ LL | type B<'a, 'b> where 'a: 'b;
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
| ^^ impl has extra requirement `'b: 'a`
error[E0478]: lifetime bound not satisfied
--> $DIR/impl_bounds.rs:16:22
|
LL | type B<'a, 'b> where 'a: 'b;
| -------------- definition of `B` from trait
...
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
| ^^^^^^^^^^^^^^^ - help: try copying this clause from the trait: `, 'a: 'b`
|
note: lifetime parameter instantiated with the lifetime `'a` as defined here
--> $DIR/impl_bounds.rs:16:12
|
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
| ^^
note: but lifetime parameter must outlive the lifetime `'b` as defined here
--> $DIR/impl_bounds.rs:16:16
|
LL | type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
| ^^
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/impl_bounds.rs:19:33
--> $DIR/impl_bounds.rs:18:33
|
LL | type C = String where Self: Copy;
| ^^^^ the trait `Copy` is not implemented for `T`
@ -62,7 +42,7 @@ LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/impl_bounds.rs:21:24
--> $DIR/impl_bounds.rs:20:24
|
LL | fn d() where Self: Copy {}
| ^^^^ the trait `Copy` is not implemented for `T`
@ -86,7 +66,7 @@ help: consider restricting type parameter `T`
LL | impl<T: std::marker::Copy> Foo for Fooy<T> {
| +++++++++++++++++++
error: aborting due to 5 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0276, E0277, E0478.
Some errors have detailed explanations: E0276, E0277.
For more information about an error, try `rustc --explain E0276`.