Skip to content

Commit 7762ac7

Browse files
committed
handle edge-case of a recursion limit of 0
1 parent bb90f81 commit 7762ac7

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_trait_selection/src/solve/search_graph

1 file changed

+5
-1
lines changed

compiler/rustc_trait_selection/src/solve/search_graph/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ pub(super) struct SearchGraph<'tcx> {
5151

5252
impl<'tcx> SearchGraph<'tcx> {
5353
pub(super) fn new(tcx: TyCtxt<'tcx>, mode: SolverMode) -> SearchGraph<'tcx> {
54+
let local_overflow_limit = {
55+
let recursion_limit = tcx.recursion_limit().0;
56+
if recursion_limit == 0 { 0 } else { recursion_limit.ilog2() as usize }
57+
};
5458
Self {
5559
mode,
56-
local_overflow_limit: tcx.recursion_limit().0.ilog2() as usize,
60+
local_overflow_limit,
5761
stack: Default::default(),
5862
provisional_cache: ProvisionalCache::empty(),
5963
}

0 commit comments

Comments
 (0)