diff options
| author | Rémy Rakic <remy.rakic@gmail.com> | 2025-01-31 13:05:10 +0100 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2025-01-31 12:24:16 +0000 |
| commit | 2c778c1e4ca8053e787998c9b18bb57222719a3d (patch) | |
| tree | 18133767bb7f102ec41e3fb8d7f10867b90679d7 | |
| parent | 25a16572a36321deae83546b63f5595d75361179 (diff) | |
ensure sufficient stack in tail call check
| -rw-r--r-- | compiler/rustc_mir_build/src/check_tail_calls.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_mir_build/src/check_tail_calls.rs b/compiler/rustc_mir_build/src/check_tail_calls.rs index 0659e3ea314..921205428db 100644 --- a/compiler/rustc_mir_build/src/check_tail_calls.rs +++ b/compiler/rustc_mir_build/src/check_tail_calls.rs @@ -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; @@ -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); + }); } } |
