Skip to content

Commit

Permalink
Inline mk_interp
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Jul 13, 2023
1 parent 1adc931 commit be4359a
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/analyz/ty_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,13 @@ impl<'tcx> ToJson<'tcx> for (interpret::ConstValue<'tcx>, ty::Ty<'tcx>) {
fn to_json(&self, mir: &mut MirState<'_, 'tcx>) -> serde_json::Value {
let (val, ty) = *self;
let op_ty = as_opty(mir.state.tcx, val, ty);
let mut icx = mk_interp(mir.state.tcx);
let mut icx = interpret::InterpCx::new(
mir.state.tcx,
DUMMY_SP,
ty::ParamEnv::reveal_all(),
RenderConstMachine::new(),
);

json!({
"ty": ty.to_json(mir),
"rendered": render_opty(mir, &mut icx, &op_ty),
Expand Down Expand Up @@ -1267,16 +1273,6 @@ pub fn mplace_ty_len<'tcx, Tag: Provenance>(mplace_ty: &MPlaceTy<'tcx, Tag>, cx:
}
}

// TODO: move
pub fn mk_interp<'mir, 'tcx>(tcx: TyCtxt<'tcx>) -> interpret::InterpCx<'mir, 'tcx, RenderConstMachine<'mir, 'tcx>> {
interpret::InterpCx::new(
tcx,
DUMMY_SP,
ty::ParamEnv::reveal_all(),
RenderConstMachine::new(),
)
}

pub fn as_opty<'tcx>(tcx: TyCtxt<'tcx>, cv: interpret::ConstValue<'tcx>, ty: ty::Ty<'tcx>)
-> interpret::OpTy<'tcx, interpret::AllocId>
{
Expand Down

0 comments on commit be4359a

Please sign in to comment.