1
Fork 0

Limit trait item mir encoding to items with default bodies

This commit is contained in:
oli 2020-10-26 15:49:11 +00:00 committed by oli
parent dadf937a12
commit 248b4dbc4f

View file

@ -1013,9 +1013,16 @@ impl EncodeContext<'a, 'tcx> {
self.encode_inferred_outlives(def_id);
// This should be kept in sync with `PrefetchVisitor.visit_trait_item`.
match trait_item.kind {
ty::AssocKind::Type => {}
ty::AssocKind::Const | ty::AssocKind::Fn => {
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id.expect_local()) {
self.encode_optimized_mir(def_id.expect_local());
self.encode_promoted_mir(def_id.expect_local());
}
}
}
}
fn metadata_output_only(&self) -> bool {
// MIR optimisation can be skipped when we're just interested in the metadata.