Skip to content

Commit 1ec9648

Browse files
committed
unconditional recursion, yeet TypingEnv::from_param_env
1 parent 948cec0 commit 1ec9648

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

compiler/rustc_mir_build/src/lints.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,16 @@ impl<'tcx> TerminatorClassifier<'tcx> for CallRecursion<'tcx> {
132132
return false;
133133
}
134134
let caller = body.source.def_id();
135-
let param_env = tcx.param_env(caller);
135+
let typing_env = body.typing_env(tcx);
136136

137137
let func_ty = func.ty(body, tcx);
138138
if let ty::FnDef(callee, args) = *func_ty.kind() {
139-
let Ok(normalized_args) =
140-
tcx.try_normalize_erasing_regions(ty::TypingEnv::from_param_env(param_env), args)
141-
else {
139+
let Ok(normalized_args) = tcx.try_normalize_erasing_regions(typing_env, args) else {
142140
return false;
143141
};
144-
let (callee, call_args) = if let Ok(Some(instance)) = Instance::try_resolve(
145-
tcx,
146-
ty::TypingEnv::from_param_env(param_env),
147-
callee,
148-
normalized_args,
149-
) {
142+
let (callee, call_args) = if let Ok(Some(instance)) =
143+
Instance::try_resolve(tcx, typing_env, callee, normalized_args)
144+
{
150145
(instance.def_id(), instance.args)
151146
} else {
152147
(callee, normalized_args)

0 commit comments

Comments
 (0)