Skip to content

Commit

Permalink
Conditionally encode boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jan 19, 2023
1 parent 9793abc commit 7e0b1f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
10 changes: 9 additions & 1 deletion compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>>>,
}
Expand Down

0 comments on commit 7e0b1f1

Please sign in to comment.