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 @@ -135,6 +135,14 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
135135 }
136136 false
137137 }
138+ // FIXME(-Znext-solver): Remove this hack when trait solver overflow can return an error.
139+ // In code like that pointed out in #128887, the type complexity we ask the solver to deal with
140+ // grows as we recurse into the call graph. If we use the same recursion limit here and in the
141+ // solver, the solver hits the limit first and emits a fatal error. But if we use a reduced
142+ // limit, we will hit the limit first and give up on looking for inlining. And in any case,
143+ // the default recursion limits are quite generous for us. If we need to recurse 64 times
144+ // into the call graph, we're probably not going to find any useful MIR inlining.
145+ let recursion_limit = tcx. recursion_limit ( ) / 2 ;
138146 process (
139147 tcx,
140148 param_env,
@@ -143,7 +151,7 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
143151 & mut Vec :: new ( ) ,
144152 & mut FxHashSet :: default ( ) ,
145153 & mut FxHashMap :: default ( ) ,
146- tcx . recursion_limit ( ) ,
154+ recursion_limit,
147155 )
148156}
149157
You can’t perform that action at this time.
0 commit comments