Skip to content

Commit 7e0b1f1

Browse files
Conditionally encode boolean
1 parent 9793abc commit 7e0b1f1

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_return_position_impl_trait_in_trait_tys => {
228236
Ok(cdata
229237
.root

compiler/rustc_metadata/src/rmeta/encoder.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1512,9 +1512,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
15121512
hir::ItemKind::Mod(ref m) => {
15131513
return self.encode_info_for_mod(item.owner_id.def_id, m);
15141514
}
1515-
hir::ItemKind::OpaqueTy(..) => {
1515+
hir::ItemKind::OpaqueTy(ref opaque) => {
15161516
self.encode_explicit_item_bounds(def_id);
1517-
record!(self.tables.is_type_alias_impl_trait[def_id] <- self.tcx.is_type_alias_impl_trait(def_id));
1517+
if matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias) {
1518+
self.tables.is_type_alias_impl_trait.set(def_id.index, ());
1519+
}
15181520
}
15191521
hir::ItemKind::Enum(..) => {
15201522
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)