diff options
| author | Rémy Rakic <remy.rakic@gmail.com> | 2025-01-31 13:05:38 +0100 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2025-01-31 12:24:16 +0000 |
| commit | 94562ee1eae83d6cc80bda4d57b43bcdb7a842b5 (patch) | |
| tree | 05e8f27be88c231d39ef8873bf2f62a5acab77bf | |
| parent | 2c778c1e4ca8053e787998c9b18bb57222719a3d (diff) | |
| download | rust-94562ee1eae83d6cc80bda4d57b43bcdb7a842b5.tar.gz rust-94562ee1eae83d6cc80bda4d57b43bcdb7a842b5.zip | |
ensure sufficient stack in unsafety check
| -rw-r--r-- | compiler/rustc_mir_build/src/check_unsafety.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 995bc311b7c..3980fdfc0b1 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; use std::mem; use std::ops::Bound; +use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_errors::DiagArgValue; use rustc_hir::def::DefKind; use rustc_hir::{self as hir, BindingMode, ByRef, HirId, Mutability}; @@ -473,7 +474,9 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { ExprKind::Scope { value, lint_level: LintLevel::Explicit(hir_id), region_scope: _ } => { let prev_id = self.hir_context; self.hir_context = hir_id; - self.visit_expr(&self.thir[value]); + ensure_sufficient_stack(|| { + self.visit_expr(&self.thir[value]); + }); self.hir_context = prev_id; return; // don't visit the whole expression } |
