1
Fork 0

Rollup merge of #127779 - momvart:should_codegen_hook, r=cjgillot

Add a hook for `should_codegen_locally`

This PR lifts the module-local function `should_codegen_locally` to `TyCtxt` as a hook.
In addition to monomorphization, this function is used for checking the dependency of `compiler_builtins` on other libraries. Moving this function to the hooks also makes overriding it possible for the tools that use the rustc interface.
This commit is contained in:
Matthias Krüger 2024-07-20 13:24:52 +02:00 committed by GitHub
commit 9a6f8ccf3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 62 additions and 58 deletions

View file

@ -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]