mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #124057 - gurry:124031-ice-layout-errored, r=compiler-errors
Fix ICE when ADT tail has type error Fixes #124031
This commit is contained in:
commit
8859631b40
@ -338,6 +338,10 @@ impl<'tcx> SizeSkeleton<'tcx> {
|
||||
debug_assert!(tail.has_non_region_param());
|
||||
Ok(SizeSkeleton::Pointer { non_zero, tail: tcx.erase_regions(tail) })
|
||||
}
|
||||
ty::Error(guar) => {
|
||||
// Fixes ICE #124031
|
||||
return Err(tcx.arena.alloc(LayoutError::ReferencesError(*guar)));
|
||||
}
|
||||
_ => bug!(
|
||||
"SizeSkeleton::compute({ty}): layout errored ({err:?}), yet \
|
||||
tail `{tail}` is not a type parameter or a projection",
|
||||
|
@ -1,10 +1,13 @@
|
||||
//@ known-bug: #124031
|
||||
// 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,
|
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…
Reference in New Issue
Block a user