diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 1f8f1fa8371..22e16f9231a 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -216,8 +216,8 @@ impl<'tcx> Inliner<'tcx> {
             // a lower `DefPathHash` than the callee. This ensures that the callee will
             // not inline us. This trick even works with incremental compilation,
             // since `DefPathHash` is stable.
-            if self.tcx.def_path_hash(caller_def_id)
-                < self.tcx.def_path_hash(callee_def_id.to_def_id())
+            if self.tcx.def_path_hash(caller_def_id).local_hash()
+                < self.tcx.def_path_hash(callee_def_id.to_def_id()).local_hash()
             {
                 return Ok(());
             }