Add a scheme for moving away from extern "rust-intrinsic"
entirely
This commit is contained in:
parent
f2612daf58
commit
1e57df1969
16 changed files with 131 additions and 8 deletions
|
@ -23,6 +23,10 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
if tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// This just reproduces the logic from Instance::requires_inline.
|
||||
match tcx.def_kind(def_id) {
|
||||
DefKind::Ctor(..) | DefKind::Closure => return true,
|
||||
|
|
|
@ -632,6 +632,12 @@ fn optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> &Body<'_> {
|
|||
}
|
||||
|
||||
fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
|
||||
if let Some(attr) = tcx.get_attr(did, sym::rustc_intrinsic_must_be_overridden) {
|
||||
span_bug!(
|
||||
attr.span,
|
||||
"this intrinsic must be overridden by the codegen backend, it has no meaningful body",
|
||||
)
|
||||
}
|
||||
if tcx.is_constructor(did.to_def_id()) {
|
||||
// There's no reason to run all of the MIR passes on constructors when
|
||||
// we can just output the MIR we want directly. This also saves const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue