1
Fork 0

Remove WithOptconstParam.

This commit is contained in:
Camille GILLOT 2022-05-08 15:53:19 +02:00
parent 0e017fc94a
commit b275d2c30b
68 changed files with 335 additions and 960 deletions

View file

@ -461,10 +461,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
instance: ty::InstanceDef<'tcx>,
promoted: Option<mir::Promoted>,
) -> InterpResult<'tcx, &'tcx mir::Body<'tcx>> {
let def = instance.with_opt_param();
trace!("load mir(instance={:?}, promoted={:?})", instance, promoted);
let body = if let Some(promoted) = promoted {
&self.tcx.promoted_mir_opt_const_arg(def)[promoted]
let def = instance.def_id();
&self.tcx.promoted_mir(def)[promoted]
} else {
M::load_mir(self, instance)?
};
@ -502,13 +502,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// The `substs` are assumed to already be in our interpreter "universe" (param_env).
pub(super) fn resolve(
&self,
def: ty::WithOptConstParam<DefId>,
def: DefId,
substs: SubstsRef<'tcx>,
) -> InterpResult<'tcx, ty::Instance<'tcx>> {
trace!("resolve: {:?}, {:#?}", def, substs);
trace!("param_env: {:#?}", self.param_env);
trace!("substs: {:#?}", substs);
match ty::Instance::resolve_opt_const_arg(*self.tcx, self.param_env, def, substs) {
match ty::Instance::resolve(*self.tcx, self.param_env, def, substs) {
Ok(Some(instance)) => Ok(instance),
Ok(None) => throw_inval!(TooGeneric),