pub fn is_call_from_compiler_builtins_to_upstream_monomorphization<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
) -> boolExpand description
Returns whether a call from the current crate to the Instance would produce a call
from compiler_builtins to a symbol the linker must resolve.
Such calls from compiler_builtins are effectively impossible for the linker to handle. Some
linkers will optimize such that dead calls to unresolved symbols are not an error, but this is
not guaranteed. So we use this function in codegen backends to ensure we do not generate any
unlinkable calls.
Note that calls to LLVM intrinsics are uniquely okay because they won’t make it to the linker.
Note also that calls to foreign items that are actually exported by the local crate are also
okay. This situation arises because compiler-builtins calls functions in core that are
#[inline] wrappers for extern "C" declarations in core, which resolve to a symbol exported
by compiler-builtins.