Skip to content

Commit 8701e80

Browse files
authored
Rollup merge of #107986 - lcnr:layout-placeholder, r=petrochenkov
layout: deal with placeholders, ICE on bound types A placeholder type is the same as a param as they represent "this could be any type". A bound type represents a type inside of a `for<T>` or `exists<T>`. When entering a forall or exists `T` should be instantiated as a existential (inference var) or universal (placeholder). You should never observe a bound variable without its binder.
2 parents 99d36b1 + 9e84b00 commit 8701e80

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/rustc_ty_utils/src/layout.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,11 @@ fn layout_of_uncached<'tcx>(
470470
return Err(LayoutError::Unknown(ty));
471471
}
472472

473-
ty::Placeholder(..)
474-
| ty::GeneratorWitness(..)
475-
| ty::GeneratorWitnessMIR(..)
476-
| ty::Infer(_) => {
473+
ty::Bound(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) | ty::Infer(_) => {
477474
bug!("Layout::compute: unexpected type `{}`", ty)
478475
}
479476

480-
ty::Bound(..) | ty::Param(_) | ty::Error(_) => {
477+
ty::Placeholder(..) | ty::Param(_) | ty::Error(_) => {
481478
return Err(LayoutError::Unknown(ty));
482479
}
483480
})

0 commit comments

Comments
 (0)