Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ensure sufficient stack in tail call check
(cherry picked from commit 2c778c1)
  • Loading branch information
lqd authored and cuviper committed Feb 6, 2025
commit 741fa9e39f5eb0e70fbb08176602c30538e404d6
13 changes: 8 additions & 5 deletions compiler/rustc_mir_build/src/check_tail_calls.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use rustc_abi::ExternAbi;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_errors::Applicability;
use rustc_hir::LangItem;
use rustc_hir::def::DefKind;
Expand Down Expand Up @@ -344,12 +345,14 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for TailCallCkVisitor<'a, 'tcx> {
}

fn visit_expr(&mut self, expr: &'a Expr<'tcx>) {
if let ExprKind::Become { value } = expr.kind {
let call = &self.thir[value];
self.check_tail_call(call, expr);
}
ensure_sufficient_stack(|| {
if let ExprKind::Become { value } = expr.kind {
let call = &self.thir[value];
self.check_tail_call(call, expr);
}

visit::walk_expr(self, expr);
visit::walk_expr(self, expr);
});
}
}

Expand Down