Fix ICE when ADT tail has type error
This commit is contained in:
parent
fb898629a2
commit
06cd79bb5b
3 changed files with 20 additions and 1 deletions
20
tests/ui/layout/ice-type-error-in-tail-124031.rs
Normal file
20
tests/ui/layout/ice-type-error-in-tail-124031.rs
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
12
tests/ui/layout/ice-type-error-in-tail-124031.stderr
Normal file
12
tests/ui/layout/ice-type-error-in-tail-124031.stderr
Normal file
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue