Skip to content

Commit

Permalink
Rollup merge of #107986 - lcnr:layout-placeholder, r=petrochenkov
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Feb 13, 2023
2 parents 99d36b1 + 9e84b00 commit 8701e80
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_ty_utils/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,11 @@ fn layout_of_uncached<'tcx>(
return Err(LayoutError::Unknown(ty));
}

ty::Placeholder(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(_) => {
ty::Bound(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) | ty::Infer(_) => {
bug!("Layout::compute: unexpected type `{}`", ty)
}

ty::Bound(..) | ty::Param(_) | ty::Error(_) => {
ty::Placeholder(..) | ty::Param(_) | ty::Error(_) => {
return Err(LayoutError::Unknown(ty));
}
})
Expand Down

0 comments on commit 8701e80

Please sign in to comment.