rust/compiler/rustc_middle
bors 11ad40bb83 Auto merge of #142625 - cjgillot:inline-nocycle, r=oli-obk
Only compute recursive callees once.

Inlining MIR in a cyclic call graph may create query cycles, which are ICEs. The current implementation `mir_callgraph_reachable(inlining_candidate, being_optimized)` checks if calling `inlining_candidate` may cycle back to `being_optimized` that we are currently inlining into.

This PR replaces this device with query `mir_callgraph_cyclic(being_optimized)` which searches the call graph for all cycles going back to `being_optimized`, and returns the set of functions involved in those cycles.

This is a tradeoff:
- in the current implementation, we perform more walks, but shallower;
- in this new implementation, we perform fewer walks, but exhaust the graph.

I'd have liked to compute this using some kind of SCC, but generic parameters make resolution path-dependent, so usual graph algorithms do not apply.
2025-06-28 19:11:42 +00:00
..
src Auto merge of #142625 - cjgillot:inline-nocycle, r=oli-obk 2025-06-28 19:11:42 +00:00
Cargo.toml Use rustc_thread_pool instead of rustc-rayon-core 2025-06-11 12:26:42 -07:00
messages.ftl Auto merge of #141759 - 1c3t3a:discriminants-query, r=saethlin 2025-06-28 10:25:00 +00:00
README.md mv compiler to compiler/ 2020-08-30 18:45:07 +03:00

For more information about how rustc works, see the rustc dev guide.