Fail candidate assembly for erroneous types
Trait predicates for types which have errors may still evaluate to OK leading to downstream ICEs. Now we return a selection error for such types in candidate assembly and thereby prevent such issues
This commit is contained in:
parent
63f70b3d10
commit
c30e15aded
12 changed files with 72 additions and 37 deletions
|
@ -91,8 +91,8 @@ fn adt_sized_constraint<'tcx>(
|
|||
let tail_ty = tcx.type_of(tail_def.did).instantiate_identity();
|
||||
|
||||
let constraint_ty = sized_constraint_for_ty(tcx, tail_ty)?;
|
||||
if constraint_ty.references_error() {
|
||||
return None;
|
||||
if let Err(guar) = constraint_ty.error_reported() {
|
||||
return Some(ty::EarlyBinder::bind(Ty::new_error(tcx, guar)));
|
||||
}
|
||||
|
||||
// perf hack: if there is a `constraint_ty: Sized` bound, then we know
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue