Don't generate functions with the rustc_intrinsic_must_be_overridden attribute

This commit is contained in:
DianQK 2024-08-19 06:26:52 +08:00
parent 334e509912
commit 4508800d20
No known key found for this signature in database
2 changed files with 17 additions and 1 deletions

View file

@ -888,7 +888,9 @@ fn visit_instance_use<'tcx>(
if tcx.should_codegen_locally(panic_instance) {
output.push(create_fn_mono_item(tcx, panic_instance, source));
}
} else if tcx.has_attr(def_id, sym::rustc_intrinsic) {
} else if tcx.has_attr(def_id, sym::rustc_intrinsic)
&& !tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden)
{
// Codegen the fallback body of intrinsics with fallback bodies
let instance = ty::Instance::new(def_id, instance.args);
if tcx.should_codegen_locally(instance) {