Skip to content

Commit 94562ee

Browse files
committed
ensure sufficient stack in unsafety check
1 parent 2c778c1 commit 94562ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/rustc_mir_build/src/check_unsafety.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::borrow::Cow;
22
use std::mem;
33
use std::ops::Bound;
44

5+
use rustc_data_structures::stack::ensure_sufficient_stack;
56
use rustc_errors::DiagArgValue;
67
use rustc_hir::def::DefKind;
78
use rustc_hir::{self as hir, BindingMode, ByRef, HirId, Mutability};
@@ -473,7 +474,9 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
473474
ExprKind::Scope { value, lint_level: LintLevel::Explicit(hir_id), region_scope: _ } => {
474475
let prev_id = self.hir_context;
475476
self.hir_context = hir_id;
476-
self.visit_expr(&self.thir[value]);
477+
ensure_sufficient_stack(|| {
478+
self.visit_expr(&self.thir[value]);
479+
});
477480
self.hir_context = prev_id;
478481
return; // don't visit the whole expression
479482
}

0 commit comments

Comments
 (0)