rust/compiler/rustc_mir_transform
许杰友 Jieyou Xu (Joe) b6015a68de
Rollup merge of #143551 - compiler-errors:root-sub, r=cjgillot
Dont resolve instance of root in `mir_callgraph_cyclic`

`Instance::try_resolve` on a default trait body method will always fail, since it's still possible to further substitute. This leads to a cycle, since in `tests/mir-opt/inline_default_trait_body.rs`, both `Trait::a` and `Trait::b` need to consider the other to be cyclical, but since we couldn't resolve a body, we'd just consider *nothing* to be cyclical.

The root instance we care about when computing `mir_callgraph_cyclic` is trivial to compute (it's just `InstanceKind::Item`), so just replace it with a call to `Instance::new_raw`.

r? `@cjgillot` `@oli-obk`

Fixes rust-lang/rust#143534
2025-07-07 19:45:41 +08:00
..