Anonymize binders in tail call sig
This commit is contained in:
parent
e1b9081e69
commit
f6ce4ac9d3
2 changed files with 18 additions and 1 deletions
|
|
@ -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:?}")
|
||||
|
|
|
|||
13
tests/ui/explicit-tail-calls/higher-ranked-arg.rs
Normal file
13
tests/ui/explicit-tail-calls/higher-ranked-arg.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Regression test for <https://github.com/rust-lang/rust/issues/144826>.
|
||||
//@ check-pass
|
||||
|
||||
#![feature(explicit_tail_calls)]
|
||||
#![expect(incomplete_features)]
|
||||
|
||||
fn foo(x: fn(&i32)) {
|
||||
become bar(x);
|
||||
}
|
||||
|
||||
fn bar(_: fn(&i32)) {}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue