diff options
| author | Michael Goulet <michael@errs.io> | 2025-08-02 17:36:34 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-08-04 15:31:50 +0000 |
| commit | f6ce4ac9d38fca2df5bc408de8f4c2567d2f2709 (patch) | |
| tree | cc4451413f9a5578de9ee41b98a03867537cf07e /compiler | |
| parent | e1b9081e699065badfc1a9419ec9566e5c8615c4 (diff) | |
| download | rust-f6ce4ac9d38fca2df5bc408de8f4c2567d2f2709.tar.gz rust-f6ce4ac9d38fca2df5bc408de8f4c2567d2f2709.zip | |
Anonymize binders in tail call sig
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_build/src/check_tail_calls.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/check_tail_calls.rs b/compiler/rustc_mir_build/src/check_tail_calls.rs index 6ed100899d8..036e20c22b8 100644 --- a/compiler/rustc_mir_build/src/check_tail_calls.rs +++ b/compiler/rustc_mir_build/src/check_tail_calls.rs @@ -60,9 +60,13 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> { let BodyTy::Fn(caller_sig) = self.thir.body_type else { span_bug!( call.span, - "`become` outside of functions should have been disallowed by hit_typeck" + "`become` outside of functions should have been disallowed by hir_typeck" ) }; + // While the `caller_sig` does have its regions erased, it does not have its + // binders anonymized. We call `erase_regions` once again to anonymize any binders + // within the signature, such as in function pointer or `dyn Trait` args. + let caller_sig = self.tcx.erase_regions(caller_sig); let ExprKind::Scope { value, .. } = call.kind else { span_bug!(call.span, "expected scope, found: {call:?}") |
