Skip to content

Commit 0966f32

Browse files
committed
Auto merge of #112673 - scottmcm:enough-stack, r=compiler-errors
Add an `ensure_sufficient_stack` to `LateContextAndPass::visit_expr` This is [apparently](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.60-alt.60-only.20failures.3F/near/365396801) where it's busting stack in #112238, and the comments for `ensure_sufficient_stack` say that > E.g. almost any call to visit_expr or equivalent can benefit from this. So this seems like a reasonable change. Hopefully it'll keep this from happening in other places too -- #111818 (comment) hit something similar when updating a lint (bors failure is https://github.com/rust-lang-ci/rust/actions/runs/5199591324/jobs/9377196369), so with any luck this will keep small permutations of things from tripping over the limit.
2 parents c84d5e7 + 44789b6 commit 0966f32

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compiler/rustc_lint/src/late.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
1717
use crate::{passes::LateLintPassObject, LateContext, LateLintPass, LintStore};
1818
use rustc_ast as ast;
19+
use rustc_data_structures::stack::ensure_sufficient_stack;
1920
use rustc_data_structures::sync::{join, DynSend};
2021
use rustc_hir as hir;
2122
use rustc_hir::def_id::LocalDefId;
@@ -157,10 +158,12 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
157158
}
158159

159160
fn visit_expr(&mut self, e: &'tcx hir::Expr<'tcx>) {
160-
self.with_lint_attrs(e.hir_id, |cx| {
161-
lint_callback!(cx, check_expr, e);
162-
hir_visit::walk_expr(cx, e);
163-
lint_callback!(cx, check_expr_post, e);
161+
ensure_sufficient_stack(|| {
162+
self.with_lint_attrs(e.hir_id, |cx| {
163+
lint_callback!(cx, check_expr, e);
164+
hir_visit::walk_expr(cx, e);
165+
lint_callback!(cx, check_expr_post, e);
166+
})
164167
})
165168
}
166169

0 commit comments

Comments
 (0)