From 72725529e19dcf52efd1fc1507e20a9c35371963 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9my=20Rakic?= <remy.rakic+github@gmail.com>
Date: Wed, 30 Aug 2023 09:43:36 +0000
Subject: [PATCH] clean up `local_overflow_limit` computation

fixes bors snafu where it merged an outdated commit and missed this
change
---
 .../rustc_trait_selection/src/solve/search_graph/mod.rs     | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/compiler/rustc_trait_selection/src/solve/search_graph/mod.rs b/compiler/rustc_trait_selection/src/solve/search_graph/mod.rs
index ca3c64b428e75..52a11abd545d1 100644
--- a/compiler/rustc_trait_selection/src/solve/search_graph/mod.rs
+++ b/compiler/rustc_trait_selection/src/solve/search_graph/mod.rs
@@ -51,13 +51,9 @@ pub(super) struct SearchGraph<'tcx> {
 
 impl<'tcx> SearchGraph<'tcx> {
     pub(super) fn new(tcx: TyCtxt<'tcx>, mode: SolverMode) -> SearchGraph<'tcx> {
-        let local_overflow_limit = {
-            let recursion_limit = tcx.recursion_limit().0;
-            if recursion_limit == 0 { 0 } else { recursion_limit.ilog2() as usize }
-        };
         Self {
             mode,
-            local_overflow_limit,
+            local_overflow_limit: tcx.recursion_limit().0.checked_ilog2().unwrap_or(0) as usize,
             stack: Default::default(),
             provisional_cache: ProvisionalCache::empty(),
         }