mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
unconditional recursion, yeet TypingEnv::from_param_env
This commit is contained in:
parent
948cec0fad
commit
1ec964873e
@ -132,21 +132,16 @@ impl<'tcx> TerminatorClassifier<'tcx> for CallRecursion<'tcx> {
|
||||
return false;
|
||||
}
|
||||
let caller = body.source.def_id();
|
||||
let param_env = tcx.param_env(caller);
|
||||
let typing_env = body.typing_env(tcx);
|
||||
|
||||
let func_ty = func.ty(body, tcx);
|
||||
if let ty::FnDef(callee, args) = *func_ty.kind() {
|
||||
let Ok(normalized_args) =
|
||||
tcx.try_normalize_erasing_regions(ty::TypingEnv::from_param_env(param_env), args)
|
||||
else {
|
||||
let Ok(normalized_args) = tcx.try_normalize_erasing_regions(typing_env, args) else {
|
||||
return false;
|
||||
};
|
||||
let (callee, call_args) = if let Ok(Some(instance)) = Instance::try_resolve(
|
||||
tcx,
|
||||
ty::TypingEnv::from_param_env(param_env),
|
||||
callee,
|
||||
normalized_args,
|
||||
) {
|
||||
let (callee, call_args) = if let Ok(Some(instance)) =
|
||||
Instance::try_resolve(tcx, typing_env, callee, normalized_args)
|
||||
{
|
||||
(instance.def_id(), instance.args)
|
||||
} else {
|
||||
(callee, normalized_args)
|
||||
|
Loading…
Reference in New Issue
Block a user