1
Fork 0

Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU

ConstBlocks are poly if their substs are poly

r? `@BoxyUwU`

fixes #106926
This commit is contained in:
Matthias Krüger 2023-01-17 05:25:23 +01:00 committed by GitHub
commit 9bcc46ee90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 89 additions and 18 deletions

View file

@ -10,17 +10,17 @@ ty_utils_address_and_deref_not_supported = dereferencing or taking the address i
ty_utils_array_not_supported = array construction is not supported in generic constants
ty_utils_block_not_supported = blocks are not supported in generic constant
ty_utils_block_not_supported = blocks are not supported in generic constants
ty_utils_never_to_any_not_supported = converting nevers to any is not supported in generic constant
ty_utils_never_to_any_not_supported = converting nevers to any is not supported in generic constants
ty_utils_tuple_not_supported = tuple construction is not supported in generic constants
ty_utils_index_not_supported = indexing is not supported in generic constant
ty_utils_index_not_supported = indexing is not supported in generic constants
ty_utils_field_not_supported = field access is not supported in generic constant
ty_utils_field_not_supported = field access is not supported in generic constants
ty_utils_const_block_not_supported = const blocks are not supported in generic constant
ty_utils_const_block_not_supported = const blocks are not supported in generic constants
ty_utils_adt_not_supported = struct/enum construction is not supported in generic constants
@ -44,4 +44,4 @@ ty_utils_control_flow_not_supported = control flow is not supported in generic c
ty_utils_inline_asm_not_supported = assembly is not supported in generic constants
ty_utils_operation_not_supported = unsupported operation in generic constant
ty_utils_operation_not_supported = unsupported operation in generic constants

View file

@ -302,13 +302,53 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
}
match expr.kind {
thir::ExprKind::NamedConst { substs, .. } => substs.has_non_region_param(),
thir::ExprKind::NamedConst { substs, .. }
| thir::ExprKind::ConstBlock { substs, .. } => substs.has_non_region_param(),
thir::ExprKind::ConstParam { .. } => true,
thir::ExprKind::Repeat { value, count } => {
self.visit_expr(&self.thir()[value]);
count.has_non_region_param()
}
_ => false,
thir::ExprKind::Scope { .. }
| thir::ExprKind::Box { .. }
| thir::ExprKind::If { .. }
| thir::ExprKind::Call { .. }
| thir::ExprKind::Deref { .. }
| thir::ExprKind::Binary { .. }
| thir::ExprKind::LogicalOp { .. }
| thir::ExprKind::Unary { .. }
| thir::ExprKind::Cast { .. }
| thir::ExprKind::Use { .. }
| thir::ExprKind::NeverToAny { .. }
| thir::ExprKind::Pointer { .. }
| thir::ExprKind::Loop { .. }
| thir::ExprKind::Let { .. }
| thir::ExprKind::Match { .. }
| thir::ExprKind::Block { .. }
| thir::ExprKind::Assign { .. }
| thir::ExprKind::AssignOp { .. }
| thir::ExprKind::Field { .. }
| thir::ExprKind::Index { .. }
| thir::ExprKind::VarRef { .. }
| thir::ExprKind::UpvarRef { .. }
| thir::ExprKind::Borrow { .. }
| thir::ExprKind::AddressOf { .. }
| thir::ExprKind::Break { .. }
| thir::ExprKind::Continue { .. }
| thir::ExprKind::Return { .. }
| thir::ExprKind::Array { .. }
| thir::ExprKind::Tuple { .. }
| thir::ExprKind::Adt(_)
| thir::ExprKind::PlaceTypeAscription { .. }
| thir::ExprKind::ValueTypeAscription { .. }
| thir::ExprKind::Closure(_)
| thir::ExprKind::Literal { .. }
| thir::ExprKind::NonHirLiteral { .. }
| thir::ExprKind::ZstLiteral { .. }
| thir::ExprKind::StaticRef { .. }
| thir::ExprKind::InlineAsm(_)
| thir::ExprKind::ThreadLocalRef(_)
| thir::ExprKind::Yield { .. } => false,
}
}
fn pat_is_poly(&mut self, pat: &thir::Pat<'tcx>) -> bool {