Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 248b4db

Browse files
olioli-obk
authored andcommitted
Limit trait item mir encoding to items with default bodies
1 parent dadf937 commit 248b4db

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,15 @@ impl EncodeContext<'a, 'tcx> {
10131013
self.encode_inferred_outlives(def_id);
10141014

10151015
// This should be kept in sync with `PrefetchVisitor.visit_trait_item`.
1016-
self.encode_optimized_mir(def_id.expect_local());
1017-
self.encode_promoted_mir(def_id.expect_local());
1016+
match trait_item.kind {
1017+
ty::AssocKind::Type => {}
1018+
ty::AssocKind::Const | ty::AssocKind::Fn => {
1019+
if self.tcx.mir_keys(LOCAL_CRATE).contains(&def_id.expect_local()) {
1020+
self.encode_optimized_mir(def_id.expect_local());
1021+
self.encode_promoted_mir(def_id.expect_local());
1022+
}
1023+
}
1024+
}
10181025
}
10191026

10201027
fn metadata_output_only(&self) -> bool {

0 commit comments

Comments
 (0)