提交 c9b5fac7 编写于 作者: R Ralf Jung

first test const-ness, then hook fn call

上级 506dd705
......@@ -246,11 +246,13 @@ fn find_fn<'a>(
ret: Option<mir::BasicBlock>,
) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>> {
debug!("eval_fn_call: {:?}", instance);
if ecx.hook_fn(instance, args, dest)? {
ecx.goto_block(ret)?; // fully evaluated and done
return Ok(None);
}
if !ecx.tcx.is_const_fn(instance.def_id()) {
// Some functions we support even if they are non-const -- but avoid testing
// that for const fn!
if ecx.hook_fn(instance, args, dest)? {
ecx.goto_block(ret)?; // fully evaluated and done
return Ok(None);
}
return Err(
ConstEvalError::NotConst(format!("calling non-const fn `{}`", instance)).into(),
);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册