Skip to content

Commit ea3ecf2

Browse files
committed
miri calls resolve_for_fn_ptr when reifying.
1 parent 8a097f2 commit ea3ecf2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/librustc_mir/interpret/cast.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
4444
if self.tcx.has_attr(def_id, sym::rustc_args_required_const) {
4545
bug!("reifying a fn ptr that requires const arguments");
4646
}
47-
let instance = self.resolve(def_id, substs)?;
47+
48+
let instance = ty::Instance::resolve_for_fn_ptr(
49+
*self.tcx,
50+
self.param_env,
51+
def_id,
52+
substs,
53+
).ok_or_else(|| err_inval!(TooGeneric))?;
54+
4855
let fn_ptr = self.memory.create_fn_alloc(FnVal::Instance(instance));
4956
self.write_scalar(Scalar::Ptr(fn_ptr.into()), dest)?;
5057
}

0 commit comments

Comments
 (0)