This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree 3 files changed +20
-1
lines changed
compiler/rustc_middle/src/ty 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -338,6 +338,10 @@ impl<'tcx> SizeSkeleton<'tcx> {
338
338
debug_assert ! ( tail. has_non_region_param( ) ) ;
339
339
Ok ( SizeSkeleton :: Pointer { non_zero, tail : tcx. erase_regions ( tail) } )
340
340
}
341
+ ty:: Error ( guar) => {
342
+ // Fixes ICE #124031
343
+ return Err ( tcx. arena . alloc ( LayoutError :: ReferencesError ( * guar) ) ) ;
344
+ }
341
345
_ => bug ! (
342
346
"SizeSkeleton::compute({ty}): layout errored ({err:?}), yet \
343
347
tail `{tail}` is not a type parameter or a projection",
Original file line number Diff line number Diff line change 1
- //@ known-bug: #124031
1
+ // Regression test for issue #124031
2
+ // Checks that we don't ICE when the tail
3
+ // of an ADT has a type error
2
4
3
5
trait Trait {
4
6
type RefTarget ;
5
7
}
6
8
7
9
impl Trait for ( ) { }
10
+ //~^ ERROR not all trait items implemented, missing: `RefTarget`
8
11
9
12
struct Other {
10
13
data : <( ) as Trait >:: RefTarget ,
Original file line number Diff line number Diff line change
1
+ error[E0046]: not all trait items implemented, missing: `RefTarget`
2
+ --> $DIR/ice-type-error-in-tail-124031.rs:9:1
3
+ |
4
+ LL | type RefTarget;
5
+ | -------------- `RefTarget` from trait
6
+ ...
7
+ LL | impl Trait for () {}
8
+ | ^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation
9
+
10
+ error: aborting due to 1 previous error
11
+
12
+ For more information about this error, try `rustc --explain E0046`.
You can’t perform that action at this time.
0 commit comments