File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
compiler/rustc_mir_transform/src/inline Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,14 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
137137 }
138138 false
139139 }
140+ // FIXME(-Znext-solver): Remove this hack when trait solver overflow can return an error.
141+ // In code like that pointed out in #128887, the type complexity we ask the solver to deal with
142+ // grows as we recurse into the call graph. If we use the same recursion limit here and in the
143+ // solver, the solver hits the limit first and emits a fatal error. But if we use a reduced
144+ // limit, we will hit the limit first and give up on looking for inlining. And in any case,
145+ // the default recursion limits are quite generous for us. If we need to recurse 64 times
146+ // into the call graph, we're probably not going to find any useful MIR inlining.
147+ let recursion_limit = tcx. recursion_limit ( ) / 2 ;
140148 process (
141149 tcx,
142150 param_env,
@@ -145,7 +153,7 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
145153 & mut Vec :: new ( ) ,
146154 & mut FxHashSet :: default ( ) ,
147155 & mut FxHashMap :: default ( ) ,
148- tcx . recursion_limit ( ) ,
156+ recursion_limit,
149157 )
150158}
151159
You can’t perform that action at this time.
0 commit comments