Don't ICE when encountering placeholders in layout computation

This commit is contained in:
Michael Goulet
2025-03-22 18:51:33 +00:00
parent aba23fd500
commit c80d9b8d67
4 changed files with 24 additions and 14 deletions

View File

@@ -611,7 +611,7 @@ fn layout_of_uncached<'tcx>(
}
// Types with no meaningful known layout.
ty::Param(_) => {
ty::Param(_) | ty::Placeholder(..) => {
return Err(error(cx, LayoutError::TooGeneric(ty)));
}
@@ -628,11 +628,7 @@ fn layout_of_uncached<'tcx>(
return Err(error(cx, err));
}
ty::Placeholder(..)
| ty::Bound(..)
| ty::CoroutineWitness(..)
| ty::Infer(_)
| ty::Error(_) => {
ty::Bound(..) | ty::CoroutineWitness(..) | ty::Infer(_) | ty::Error(_) => {
// `ty::Error` is handled at the top of this function.
bug!("layout_of: unexpected type `{ty}`")
}