forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#124057 - gurry:124031-ice-layout-errored, r…
…=compiler-errors Fix ICE when ADT tail has type error Fixes rust-lang#124031
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 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 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 @@ | ||
// Regression test for issue #124031 | ||
// Checks that we don't ICE when the tail | ||
// of an ADT has a type error | ||
|
||
trait Trait { | ||
type RefTarget; | ||
} | ||
|
||
impl Trait for () {} | ||
//~^ ERROR not all trait items implemented, missing: `RefTarget` | ||
|
||
struct Other { | ||
data: <() as Trait>::RefTarget, | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
std::mem::transmute::<Option<()>, Option<&Other>>(None); | ||
} | ||
} |
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[E0046]: not all trait items implemented, missing: `RefTarget` | ||
--> $DIR/ice-type-error-in-tail-124031.rs:9:1 | ||
| | ||
LL | type RefTarget; | ||
| -------------- `RefTarget` from trait | ||
... | ||
LL | impl Trait for () {} | ||
| ^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0046`. |