@@ -414,48 +414,6 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> {
414
414
}
415
415
}
416
416
417
- pub(crate) fn mir_const_from_ty_const<'tcx>(
418
- tables: &mut Tables<'tcx>,
419
- ty_const: ty::Const<'tcx>,
420
- ty: Ty<'tcx>,
421
- ) -> stable_mir::ty::MirConst {
422
- let kind = match ty_const.kind() {
423
- ty::ConstKind::Value(ty, val) => {
424
- let val = match val {
425
- ty::ValTree::Leaf(scalar) => ty::ValTree::Leaf(scalar),
426
- ty::ValTree::Branch(branch) => {
427
- ty::ValTree::Branch(tables.tcx.lift(branch).unwrap())
428
- }
429
- };
430
- let ty = tables.tcx.lift(ty).unwrap();
431
- let const_val = tables.tcx.valtree_to_const_val((ty, val));
432
- if matches!(const_val, mir::ConstValue::ZeroSized) {
433
- stable_mir::ty::ConstantKind::ZeroSized
434
- } else {
435
- stable_mir::ty::ConstantKind::Allocated(alloc::new_allocation(
436
- ty, const_val, tables,
437
- ))
438
- }
439
- }
440
- ty::ConstKind::Param(param) => stable_mir::ty::ConstantKind::Param(param.stable(tables)),
441
- ty::ConstKind::Error(_) => unreachable!(),
442
- ty::ConstKind::Infer(_) => unreachable!(),
443
- ty::ConstKind::Bound(_, _) => unimplemented!(),
444
- ty::ConstKind::Placeholder(_) => unimplemented!(),
445
- ty::ConstKind::Unevaluated(uv) => {
446
- stable_mir::ty::ConstantKind::Unevaluated(stable_mir::ty::UnevaluatedConst {
447
- def: tables.const_def(uv.def),
448
- args: uv.args.stable(tables),
449
- promoted: None,
450
- })
451
- }
452
- ty::ConstKind::Expr(_) => unimplemented!(),
453
- };
454
- let stable_ty = tables.intern_ty(ty);
455
- let id = tables.intern_mir_const(mir::Const::Ty(ty, ty_const));
456
- stable_mir::ty::MirConst::new(kind, stable_ty, id)
457
- }
458
-
459
417
impl<'tcx> Stable<'tcx> for ty::Const<'tcx> {
460
418
type T = stable_mir::ty::TyConst;
461
419
0 commit comments