Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
5 changes: 4 additions & 1 deletion compiler/rustc_mir_build/src/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
}
Expand Down
Loading