Make supertrait and implied predicates queries defaulted

This commit is contained in:
Michael Goulet 2024-08-29 12:53:30 -04:00
parent 842d6fc32e
commit 42d2d7894c
3 changed files with 8 additions and 10 deletions

View File

@ -247,8 +247,8 @@ provide! { tcx, def_id, other, cdata,
explicit_predicates_of => { table } explicit_predicates_of => { table }
generics_of => { table } generics_of => { table }
inferred_outlives_of => { table_defaulted_array } inferred_outlives_of => { table_defaulted_array }
explicit_super_predicates_of => { table } explicit_super_predicates_of => { table_defaulted_array }
explicit_implied_predicates_of => { table } explicit_implied_predicates_of => { table_defaulted_array }
type_of => { table } type_of => { table }
type_alias_is_lazy => { table_direct } type_alias_is_lazy => { table_direct }
variances_of => { table } variances_of => { table }

View File

@ -1443,9 +1443,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
} }
if let DefKind::Trait = def_kind { if let DefKind::Trait = def_kind {
record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id));
record_array!(self.tables.explicit_super_predicates_of[def_id] <- record_defaulted_array!(self.tables.explicit_super_predicates_of[def_id] <-
self.tcx.explicit_super_predicates_of(def_id).skip_binder()); self.tcx.explicit_super_predicates_of(def_id).skip_binder());
record_array!(self.tables.explicit_implied_predicates_of[def_id] <- record_defaulted_array!(self.tables.explicit_implied_predicates_of[def_id] <-
self.tcx.explicit_implied_predicates_of(def_id).skip_binder()); self.tcx.explicit_implied_predicates_of(def_id).skip_binder());
let module_children = self.tcx.module_children_local(local_id); let module_children = self.tcx.module_children_local(local_id);
@ -1454,9 +1454,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
} }
if let DefKind::TraitAlias = def_kind { if let DefKind::TraitAlias = def_kind {
record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id)); record!(self.tables.trait_def[def_id] <- self.tcx.trait_def(def_id));
record_array!(self.tables.explicit_super_predicates_of[def_id] <- record_defaulted_array!(self.tables.explicit_super_predicates_of[def_id] <-
self.tcx.explicit_super_predicates_of(def_id).skip_binder()); self.tcx.explicit_super_predicates_of(def_id).skip_binder());
record_array!(self.tables.explicit_implied_predicates_of[def_id] <- record_defaulted_array!(self.tables.explicit_implied_predicates_of[def_id] <-
self.tcx.explicit_implied_predicates_of(def_id).skip_binder()); self.tcx.explicit_implied_predicates_of(def_id).skip_binder());
} }
if let DefKind::Trait | DefKind::Impl { .. } = def_kind { if let DefKind::Trait | DefKind::Impl { .. } = def_kind {

View File

@ -390,6 +390,8 @@ define_tables! {
explicit_item_bounds: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>, explicit_item_bounds: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
explicit_item_super_predicates: 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)>>, inferred_outlives_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
explicit_super_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>, inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>, associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>,
associated_type_for_effects: Table<DefIndex, Option<LazyValue<DefId>>>, associated_type_for_effects: Table<DefIndex, Option<LazyValue<DefId>>>,
@ -419,10 +421,6 @@ define_tables! {
lookup_deprecation_entry: Table<DefIndex, LazyValue<attr::Deprecation>>, lookup_deprecation_entry: Table<DefIndex, LazyValue<attr::Deprecation>>,
explicit_predicates_of: Table<DefIndex, LazyValue<ty::GenericPredicates<'static>>>, explicit_predicates_of: Table<DefIndex, LazyValue<ty::GenericPredicates<'static>>>,
generics_of: Table<DefIndex, LazyValue<ty::Generics>>, generics_of: Table<DefIndex, LazyValue<ty::Generics>>,
explicit_super_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
// As an optimization, we only store this for trait aliases,
// since it's identical to explicit_super_predicates_of for traits.
explicit_implied_predicates_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
type_of: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>, type_of: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>,
variances_of: Table<DefIndex, LazyArray<ty::Variance>>, variances_of: Table<DefIndex, LazyArray<ty::Variance>>,
fn_sig: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>, fn_sig: Table<DefIndex, LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>,