about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/inline.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2025-06-19 08:47:39 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2025-06-23 08:44:31 +0000
commit2074013f44e4b12a0949182d050d3470bd76e4de (patch)
treedb174cb40989baa8fd4b937e81c8fe80ae7c6133 /compiler/rustc_mir_transform/src/inline.rs
parent8a35c7ac5b9b3d311253f2935a4b68ab293dc960 (diff)
downloadrust-2074013f44e4b12a0949182d050d3470bd76e4de.tar.gz
rust-2074013f44e4b12a0949182d050d3470bd76e4de.zip
Only store the LocalDefId instead of the whole instance.
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs5
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 0972e95a238..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_cyclic(caller_def_id.expect_local()).contains(&callee) {
+        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");
         }