-
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.
Use subtyping instead of equality, since method resolution also uses …
…subtyping
- Loading branch information
Showing
13 changed files
with
101 additions
and
22 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
10 changes: 10 additions & 0 deletions
10
tests/ui/associated-consts/wrong-projection-self-ty-on-invalid-type.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-on-invalid-type.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-on-invalid-type.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-on-invalid-type2.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-on-invalid-type2.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-on-invalid-type2.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-on-invalid-type2.rs:5:18 | ||
| | ||
LL | type Assoc = T; | ||
| ^ | ||
note: required by a bound in `Fail` | ||
--> $DIR/wrong-projection-self-ty-on-invalid-type2.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`. |
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:19: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`. |
8 changes: 4 additions & 4 deletions
8
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