-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #126128 - oli-obk:method_ice, r=lcnr
Consistently use subtyping in method resolution fixes #126062 An earlier version of this PR modified how we compute variance, but the root cause was an inconsistency between the usage of `eq` and `sub`, where we assumed that the latter passing implies the former will pass. r? `@compiler-errors`
- Loading branch information
Showing
16 changed files
with
108 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
struct Fail<T>; | ||
//~^ ERROR: type parameter `T` is never used | ||
|
||
impl Fail<i32> { | ||
const C: () = (); | ||
} | ||
|
||
fn main() { | ||
Fail::<()>::C | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0392]: type parameter `T` is never used | ||
--> $DIR/wrong-projection-self-ty-invalid-bivariant-arg.rs:1:13 | ||
| | ||
LL | struct Fail<T>; | ||
| ^ unused type parameter | ||
| | ||
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` | ||
= help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0392`. |
17 changes: 17 additions & 0 deletions
17
tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
trait Proj { | ||
type Assoc; | ||
} | ||
impl<T> Proj for T { | ||
type Assoc = T; | ||
} | ||
|
||
struct Fail<T: Proj<Assoc = U>, U>(T); | ||
|
||
impl Fail<i32, i32> { | ||
const C: () = (); | ||
} | ||
|
||
fn main() { | ||
Fail::<i32, u32>::C | ||
//~^ ERROR: type mismatch | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0271]: type mismatch resolving `<i32 as Proj>::Assoc == u32` | ||
--> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:5 | ||
| | ||
LL | Fail::<i32, u32>::C | ||
| ^^^^^^^^^^^^^^^^ type mismatch resolving `<i32 as Proj>::Assoc == u32` | ||
| | ||
note: expected this to be `u32` | ||
--> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:5:18 | ||
| | ||
LL | type Assoc = T; | ||
| ^ | ||
note: required by a bound in `Fail` | ||
--> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:8:21 | ||
| | ||
LL | struct Fail<T: Proj<Assoc = U>, U>(T); | ||
| ^^^^^^^^^ required by this bound in `Fail` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0271`. |
19 changes: 0 additions & 19 deletions
19
tests/ui/coercion/coerce-issue-49593-box-never-windows.nofallback.stderr
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
tests/ui/coercion/coerce-issue-49593-box-never.fallback.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0277]: the trait bound `(): std::error::Error` is not satisfied | ||
--> $DIR/coerce-issue-49593-box-never.rs:18:5 | ||
| | ||
LL | Box::<_ /* ! */>::new(x) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `()` | ||
| | ||
= note: required for the cast from `Box<()>` to `Box<(dyn std::error::Error + 'static)>` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
12 changes: 6 additions & 6 deletions
12
tests/ui/coercion/coerce-issue-49593-box-never.nofallback.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters