File tree 1 file changed +9
-1
lines changed
compiler/rustc_mir_transform/src/inline
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>(
137
137
}
138
138
false
139
139
}
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 ;
140
148
process (
141
149
tcx,
142
150
param_env,
@@ -145,7 +153,7 @@ pub(crate) fn mir_callgraph_reachable<'tcx>(
145
153
& mut Vec :: new ( ) ,
146
154
& mut FxHashSet :: default ( ) ,
147
155
& mut FxHashMap :: default ( ) ,
148
- tcx . recursion_limit ( ) ,
156
+ recursion_limit,
149
157
)
150
158
}
151
159
You can’t perform that action at this time.
0 commit comments