1
Fork 0

It's not about types or consts, but the lack of regions

This commit is contained in:
Oli Scherer 2022-10-04 09:43:34 +00:00
parent ead49f0beb
commit c7b6ebdf7c
30 changed files with 71 additions and 77 deletions

View file

@ -135,30 +135,30 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
fn expr_is_poly(&mut self, expr: &thir::Expr<'tcx>) -> bool {
if expr.ty.has_param_types_or_consts() {
if expr.ty.has_non_region_param() {
return true;
}
match expr.kind {
thir::ExprKind::NamedConst { substs, .. } => substs.has_param_types_or_consts(),
thir::ExprKind::NamedConst { substs, .. } => substs.has_non_region_param(),
thir::ExprKind::ConstParam { .. } => true,
thir::ExprKind::Repeat { value, count } => {
self.visit_expr(&self.thir()[value]);
count.has_param_types_or_consts()
count.has_non_region_param()
}
_ => false,
}
}
fn pat_is_poly(&mut self, pat: &thir::Pat<'tcx>) -> bool {
if pat.ty.has_param_types_or_consts() {
if pat.ty.has_non_region_param() {
return true;
}
match pat.kind {
thir::PatKind::Constant { value } => value.has_param_types_or_consts(),
thir::PatKind::Constant { value } => value.has_non_region_param(),
thir::PatKind::Range(box thir::PatRange { lo, hi, .. }) => {
lo.has_param_types_or_consts() || hi.has_param_types_or_consts()
lo.has_non_region_param() || hi.has_non_region_param()
}
_ => false,
}

View file

@ -351,7 +351,7 @@ fn layout_of_uncached<'tcx>(
let univariant = |fields: &[TyAndLayout<'_>], repr: &ReprOptions, kind| {
Ok(tcx.intern_layout(univariant_uninterned(cx, ty, fields, repr, kind)?))
};
debug_assert!(!ty.has_infer_types_or_consts());
debug_assert!(!ty.has_non_region_infer());
Ok(match *ty.kind() {
// Basic scalars.
@ -1688,7 +1688,7 @@ fn record_layout_for_printing_outlined<'tcx>(
// Ignore layouts that are done with non-empty environments or
// non-monomorphic layouts, as the user only wants to see the stuff
// resulting from the final codegen session.
if layout.ty.has_param_types_or_consts() || !cx.param_env.caller_bounds().is_empty() {
if layout.ty.has_non_region_param() || !cx.param_env.caller_bounds().is_empty() {
return;
}