1
Fork 0

rustc_intrinsic: support functions without body; they are implicitly marked as must-be-overridden

This commit is contained in:
Ralf Jung 2025-01-04 11:41:51 +01:00
parent be65012aa3
commit 3cd3649c6c
19 changed files with 118 additions and 68 deletions

View file

@ -190,7 +190,8 @@ impl<'tcx> Inliner<'tcx> {
// Intrinsic fallback bodies are automatically made cross-crate inlineable,
// but at this stage we don't know whether codegen knows the intrinsic,
// so just conservatively don't inline it.
// so just conservatively don't inline it. This also ensures that we do not
// accidentally inline the body of an intrinsic that *must* be overridden.
if self.tcx.has_attr(callsite.callee.def_id(), sym::rustc_intrinsic) {
return Err("Callee is an intrinsic, do not inline fallback bodies");
}