introduce ty::Value

Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
This commit is contained in:
Lukas Markeffsky
2025-01-27 04:30:00 +01:00
parent 5a45ab9738
commit 10fc0b159e
44 changed files with 214 additions and 205 deletions

View File

@@ -22,16 +22,16 @@ fn destructure_const<'tcx>(
tcx: TyCtxt<'tcx>,
const_: ty::Const<'tcx>,
) -> ty::DestructuredConst<'tcx> {
let ty::ConstKind::Value(ct_ty, valtree) = const_.kind() else {
let ty::ConstKind::Value(cv) = const_.kind() else {
bug!("cannot destructure constant {:?}", const_)
};
let branches = match valtree {
let branches = match cv.valtree {
ty::ValTree::Branch(b) => b,
_ => bug!("cannot destructure constant {:?}", const_),
};
let (fields, variant) = match ct_ty.kind() {
let (fields, variant) = match cv.ty.kind() {
ty::Array(inner_ty, _) | ty::Slice(inner_ty) => {
// construct the consts for the elements of the array/slice
let field_consts = branches