diff options
| author | Laurențiu Nicola <lnicola@users.noreply.github.com> | 2025-06-30 15:11:33 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-30 15:11:33 +0000 |
| commit | c5f4b80cb9a678297548ea13feb2e57696e09e6e (patch) | |
| tree | 69ecc9ed7f6fb830c4814d1085ba96820b4ab864 /compiler/rustc_mir_transform/src/inline.rs | |
| parent | 863d0b5d53ebd5aa2d3c2c415fff841741c3937c (diff) | |
| parent | 0edf5726c773484b53f9612f687dec916a60883f (diff) | |
| download | rust-c5f4b80cb9a678297548ea13feb2e57696e09e6e.tar.gz rust-c5f4b80cb9a678297548ea13feb2e57696e09e6e.zip | |
Merge pull request #20128 from lnicola/sync-from-rust
Sync from downstream
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index f48dba9663a..c27087fea11 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -770,14 +770,15 @@ fn check_mir_is_available<'tcx, I: Inliner<'tcx>>( return Ok(()); } - if callee_def_id.is_local() + if let Some(callee_def_id) = callee_def_id.as_local() && !inliner .tcx() .is_lang_item(inliner.tcx().parent(caller_def_id), rustc_hir::LangItem::FnOnce) { // If we know for sure that the function we're calling will itself try to // call us, then we avoid inlining that function. - if inliner.tcx().mir_callgraph_reachable((callee, caller_def_id.expect_local())) { + if inliner.tcx().mir_callgraph_cyclic(caller_def_id.expect_local()).contains(&callee_def_id) + { debug!("query cycle avoidance"); return Err("caller might be reachable from callee"); } |
