1
Fork 0

Remove the trivial constkind imports

This commit is contained in:
Michael Goulet 2024-11-03 21:36:21 +00:00
parent 43c78051ea
commit 8e6af16192
5 changed files with 23 additions and 27 deletions

View file

@ -418,7 +418,7 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
ty: Ty<'tcx>,
) -> stable_mir::ty::MirConst {
let kind = match ty_const.kind() {
ty::Value(ty, val) => {
ty::ConstKind::Value(ty, val) => {
let val = match val {
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
ty::ValTree::Branch(branch) => {
@ -435,19 +435,19 @@ pub(crate) fn mir_const_from_ty_const<'tcx>(
))
}
}
ty::ParamCt(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
ty::ErrorCt(_) => unreachable!(),
ty::InferCt(_) => unreachable!(),
ty::BoundCt(_, _) => unimplemented!(),
ty::PlaceholderCt(_) => unimplemented!(),
ty::Unevaluated(uv) => {
ty::ConstKind::Param(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
ty::ConstKind::Error(_) => unreachable!(),
ty::ConstKind::Infer(_) => unreachable!(),
ty::ConstKind::Bound(_, _) => unimplemented!(),
ty::ConstKind::Placeholder(_) => unimplemented!(),
ty::ConstKind::Unevaluated(uv) => {
stable_mir::ty::ConstantKind::Unevaluated(stable_mir::ty::UnevaluatedConst {
def: tables.const_def(uv.def),
args: uv.args.stable(tables),
promoted: None,
})
}
ty::ExprCt(_) => unimplemented!(),
ty::ConstKind::Expr(_) => unimplemented!(),
};
let stable_ty = tables.intern_ty(ty);
let id = tables.intern_mir_const(mir::Const::Ty(ty, ty_const));
@ -459,7 +459,7 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
fn stable(&self, tables: &mut Tables<'_>) -> Self::T {
let kind = match self.kind() {
ty::Value(ty, val) => {
ty::ConstKind::Value(ty, val) => {
let val = match val {
ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
ty::ValTree::Branch(branch) => {
@ -478,16 +478,16 @@ impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
)
}
}
ty::ParamCt(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
ty::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
ty::ConstKind::Param(param) => stable_mir::ty::TyConstKind::Param(param.stable(tables)),
ty::ConstKind::Unevaluated(uv) => stable_mir::ty::TyConstKind::Unevaluated(
tables.const_def(uv.def),
uv.args.stable(tables),
),
ty::ErrorCt(_) => unreachable!(),
ty::InferCt(_) => unreachable!(),
ty::BoundCt(_, _) => unimplemented!(),
ty::PlaceholderCt(_) => unimplemented!(),
ty::ExprCt(_) => unimplemented!(),
ty::ConstKind::Error(_) => unreachable!(),
ty::ConstKind::Infer(_) => unreachable!(),
ty::ConstKind::Bound(_, _) => unimplemented!(),
ty::ConstKind::Placeholder(_) => unimplemented!(),
ty::ConstKind::Expr(_) => unimplemented!(),
};
let id = tables.intern_ty_const(tables.tcx.lift(*self).unwrap());
stable_mir::ty::TyConst::new(kind, id)