Skip to content

Commit a0f0a5f

Browse files
compiler-errorsMark-Simulacrum
authored andcommitted
Conditionally encode boolean
1 parent 4432930 commit a0f0a5f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,15 @@ provide! { tcx, def_id, other, cdata,
223223
generator_kind => { table }
224224
trait_def => { table }
225225
deduced_param_attrs => { table }
226-
is_type_alias_impl_trait => { table }
226+
is_type_alias_impl_trait => {
227+
debug_assert_eq!(tcx.def_kind(def_id), DefKind::OpaqueTy);
228+
cdata
229+
.root
230+
.tables
231+
.is_type_alias_impl_trait
232+
.get(cdata, def_id.index)
233+
.is_some()
234+
}
227235
collect_trait_impl_trait_tys => {
228236
Ok(cdata
229237
.root

compiler/rustc_metadata/src/rmeta/encoder.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1535,9 +1535,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
15351535
hir::ItemKind::Mod(ref m) => {
15361536
return self.encode_info_for_mod(item.owner_id.def_id, m);
15371537
}
1538-
hir::ItemKind::OpaqueTy(..) => {
1538+
hir::ItemKind::OpaqueTy(ref opaque) => {
15391539
self.encode_explicit_item_bounds(def_id);
1540-
record!(self.tables.is_type_alias_impl_trait[def_id] <- self.tcx.is_type_alias_impl_trait(def_id));
1540+
if matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias) {
1541+
self.tables.is_type_alias_impl_trait.set(def_id.index, ());
1542+
}
15411543
}
15421544
hir::ItemKind::Enum(..) => {
15431545
let adt_def = self.tcx.adt_def(def_id);

compiler/rustc_metadata/src/rmeta/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ define_tables! {
404404
proc_macro: Table<DefIndex, MacroKind>,
405405
module_reexports: Table<DefIndex, LazyArray<ModChild>>,
406406
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
407-
is_type_alias_impl_trait: Table<DefIndex, LazyValue<bool>>,
407+
// Slot is full when opaque is TAIT.
408+
is_type_alias_impl_trait: Table<DefIndex, ()>,
408409

409410
trait_impl_trait_tys: Table<DefIndex, LazyValue<FxHashMap<DefId, Ty<'static>>>>,
410411
}

0 commit comments

Comments
 (0)