Split item bounds and item super predicates
This commit is contained in:
parent
a128516cf9
commit
aa39dbb962
20 changed files with 186 additions and 46 deletions
|
@ -1063,6 +1063,20 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
ty::EarlyBinder::bind(&*output)
|
||||
}
|
||||
|
||||
fn get_explicit_item_super_predicates(
|
||||
self,
|
||||
index: DefIndex,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
) -> ty::EarlyBinder<&'tcx [(ty::Clause<'tcx>, Span)]> {
|
||||
let lazy = self.root.tables.explicit_item_super_predicates.get(self, index);
|
||||
let output = if lazy.is_default() {
|
||||
&mut []
|
||||
} else {
|
||||
tcx.arena.alloc_from_iter(lazy.decode((self, tcx)))
|
||||
};
|
||||
ty::EarlyBinder::bind(&*output)
|
||||
}
|
||||
|
||||
fn get_variant(
|
||||
self,
|
||||
kind: DefKind,
|
||||
|
|
|
@ -206,6 +206,7 @@ impl IntoArgs for (CrateNum, SimplifiedType) {
|
|||
|
||||
provide! { tcx, def_id, other, cdata,
|
||||
explicit_item_bounds => { cdata.get_explicit_item_bounds(def_id.index, tcx) }
|
||||
explicit_item_super_predicates => { cdata.get_explicit_item_super_predicates(def_id.index, tcx) }
|
||||
explicit_predicates_of => { table }
|
||||
generics_of => { table }
|
||||
inferred_outlives_of => { table_defaulted_array }
|
||||
|
|
|
@ -1491,6 +1491,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
if let DefKind::OpaqueTy = def_kind {
|
||||
self.encode_explicit_item_bounds(def_id);
|
||||
self.encode_explicit_item_super_predicates(def_id);
|
||||
self.tables
|
||||
.is_type_alias_impl_trait
|
||||
.set(def_id.index, self.tcx.is_type_alias_impl_trait(def_id));
|
||||
|
@ -1599,6 +1600,12 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
record_defaulted_array!(self.tables.explicit_item_bounds[def_id] <- bounds);
|
||||
}
|
||||
|
||||
fn encode_explicit_item_super_predicates(&mut self, def_id: DefId) {
|
||||
debug!("EncodeContext::encode_explicit_item_super_predicates({:?})", def_id);
|
||||
let bounds = self.tcx.explicit_item_super_predicates(def_id).skip_binder();
|
||||
record_defaulted_array!(self.tables.explicit_item_super_predicates[def_id] <- bounds);
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
fn encode_info_for_assoc_item(&mut self, def_id: DefId) {
|
||||
let tcx = self.tcx;
|
||||
|
@ -1611,6 +1618,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
AssocItemContainer::TraitContainer => {
|
||||
if let ty::AssocKind::Type = item.kind {
|
||||
self.encode_explicit_item_bounds(def_id);
|
||||
self.encode_explicit_item_super_predicates(def_id);
|
||||
}
|
||||
}
|
||||
AssocItemContainer::ImplContainer => {
|
||||
|
|
|
@ -387,6 +387,7 @@ define_tables! {
|
|||
// corresponding DefPathHash.
|
||||
def_path_hashes: Table<DefIndex, u64>,
|
||||
explicit_item_bounds: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
|
||||
explicit_item_super_predicates: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
|
||||
inferred_outlives_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
|
||||
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
|
||||
associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue