Skip to content

Commit 03b03f9

Browse files
committed
Reuse the ty::Const: Stable impl
1 parent 3a736a7 commit 03b03f9

File tree

1 file changed

+3
-5
lines changed
  • compiler/rustc_smir/src/rustc_smir

1 file changed

+3
-5
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use crate::rustc_internal::{self, opaque};
1111
use crate::stable_mir::mir::{CopyNonOverlapping, UserTypeProjection, VariantIdx};
1212
use crate::stable_mir::ty::{
13-
allocation_filter, new_allocation, Const, FloatTy, GenericParamDef, IntTy, Movability, RigidTy,
13+
allocation_filter, new_allocation, FloatTy, GenericParamDef, IntTy, Movability, RigidTy,
1414
TyKind, UintTy,
1515
};
1616
use crate::stable_mir::{self, Context};
@@ -205,8 +205,7 @@ impl<'tcx> Stable<'tcx> for mir::Rvalue<'tcx> {
205205
match self {
206206
Use(op) => stable_mir::mir::Rvalue::Use(op.stable(tables)),
207207
Repeat(op, len) => {
208-
let cnst = ConstantKind::from_const(*len, tables.tcx);
209-
let len = Const { literal: cnst.stable(tables) };
208+
let len = len.stable(tables);
210209
stable_mir::mir::Rvalue::Repeat(op.stable(tables), len)
211210
}
212211
Ref(region, kind, place) => stable_mir::mir::Rvalue::Ref(
@@ -394,8 +393,7 @@ impl<'tcx> Stable<'tcx> for ty::TermKind<'tcx> {
394393
match self {
395394
ty::TermKind::Ty(ty) => TermKind::Type(tables.intern_ty(*ty)),
396395
ty::TermKind::Const(cnst) => {
397-
let cnst = ConstantKind::from_const(*cnst, tables.tcx);
398-
let cnst = Const { literal: cnst.stable(tables) };
396+
let cnst = cnst.stable(tables);
399397
TermKind::Const(cnst)
400398
}
401399
}

0 commit comments

Comments
 (0)