Conditionally encode boolean

This commit is contained in:
Michael Goulet 2023-01-19 16:09:10 +00:00
parent 9793abc209
commit 7e0b1f1115
3 changed files with 15 additions and 4 deletions

View File

@ -223,7 +223,15 @@ provide! { tcx, def_id, other, cdata,
generator_kind => { table }
trait_def => { table }
deduced_param_attrs => { table }
is_type_alias_impl_trait => { table }
is_type_alias_impl_trait => {
debug_assert_eq!(tcx.def_kind(def_id), DefKind::OpaqueTy);
cdata
.root
.tables
.is_type_alias_impl_trait
.get(cdata, def_id.index)
.is_some()
}
collect_return_position_impl_trait_in_trait_tys => {
Ok(cdata
.root

View File

@ -1512,9 +1512,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
hir::ItemKind::Mod(ref m) => {
return self.encode_info_for_mod(item.owner_id.def_id, m);
}
hir::ItemKind::OpaqueTy(..) => {
hir::ItemKind::OpaqueTy(ref opaque) => {
self.encode_explicit_item_bounds(def_id);
record!(self.tables.is_type_alias_impl_trait[def_id] <- self.tcx.is_type_alias_impl_trait(def_id));
if matches!(opaque.origin, hir::OpaqueTyOrigin::TyAlias) {
self.tables.is_type_alias_impl_trait.set(def_id.index, ());
}
}
hir::ItemKind::Enum(..) => {
let adt_def = self.tcx.adt_def(def_id);

View File

@ -404,7 +404,8 @@ define_tables! {
proc_macro: Table<DefIndex, MacroKind>,
module_reexports: Table<DefIndex, LazyArray<ModChild>>,
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,
is_type_alias_impl_trait: Table<DefIndex, LazyValue<bool>>,
// Slot is full when opaque is TAIT.
is_type_alias_impl_trait: Table<DefIndex, ()>,
trait_impl_trait_tys: Table<DefIndex, LazyValue<FxHashMap<DefId, Ty<'static>>>>,
}