about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/hooks/mod.rs
diff options
context:
space:
mode:
authorMohammad Omidvar <m_omidvart@sfu.ca>2024-07-15 19:54:47 +0000
committerMohammad Omidvar <m_omidvart@sfu.ca>2024-07-15 19:54:47 +0000
commit0d508bb0cd681bf15f7861670cd38a1b352d2e40 (patch)
treee80c3db6d8d3cb3e74d07f132c0a962ec4ebf7af /compiler/rustc_middle/src/hooks/mod.rs
parentd3dd34a1d4a7e25a92a0d65994bb01a5d17c59ee (diff)
downloadrust-0d508bb0cd681bf15f7861670cd38a1b352d2e40.tar.gz
rust-0d508bb0cd681bf15f7861670cd38a1b352d2e40.zip
Introduce and provide a hook for `should_codegen_locally`
Diffstat (limited to 'compiler/rustc_middle/src/hooks/mod.rs')
-rw-r--r--compiler/rustc_middle/src/hooks/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/hooks/mod.rs b/compiler/rustc_middle/src/hooks/mod.rs
index bf10a71dbae..75dc685a16a 100644
--- a/compiler/rustc_middle/src/hooks/mod.rs
+++ b/compiler/rustc_middle/src/hooks/mod.rs
@@ -103,6 +103,10 @@ declare_hooks! {
 
     /// Create a list-like THIR representation for debugging.
     hook thir_flat(key: LocalDefId) -> String;
+
+    /// Returns `true` if we should codegen an instance in the local crate, or returns `false` if we
+    /// can just link to the upstream crate and therefore don't need a mono item.
+    hook should_codegen_locally(instance: crate::ty::Instance<'tcx>) -> bool;
 }
 
 #[cold]