mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Auto merge of #109089 - compiler-errors:opt_rpitit_info-follow-up, r=spastorino
Encode `opt_rpitit_info` for associated types Follow-up, only last commit matters r? `@spastorino` This needs a perf run after the parent pr lands
This commit is contained in:
commit
992d154f3a
@ -1087,6 +1087,8 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
_ => bug!("cannot get associated-item of `{:?}`", self.def_key(id)),
|
||||
};
|
||||
let container = self.root.tables.assoc_container.get(self, id).unwrap();
|
||||
let opt_rpitit_info =
|
||||
self.root.tables.opt_rpitit_info.get(self, id).map(|d| d.decode(self));
|
||||
|
||||
ty::AssocItem {
|
||||
name,
|
||||
@ -1095,8 +1097,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
trait_item_def_id: self.get_trait_item_def_id(id),
|
||||
container,
|
||||
fn_has_self_parameter: has_self,
|
||||
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty): We need to encode this
|
||||
opt_rpitit_info: None,
|
||||
opt_rpitit_info,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1350,6 +1350,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
if trait_item.kind == ty::AssocKind::Fn {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
}
|
||||
if let Some(rpitit_info) = trait_item.opt_rpitit_info {
|
||||
let rpitit_info = self.lazy(rpitit_info);
|
||||
self.tables.opt_rpitit_info.set_some(def_id.index, rpitit_info);
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_info_for_impl_item(&mut self, def_id: DefId) {
|
||||
@ -1384,6 +1388,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
|
||||
self.tables.is_intrinsic.set(def_id.index, tcx.is_intrinsic(def_id));
|
||||
}
|
||||
if let Some(rpitit_info) = impl_item.opt_rpitit_info {
|
||||
let rpitit_info = self.lazy(rpitit_info);
|
||||
self.tables.opt_rpitit_info.set_some(def_id.index, rpitit_info);
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_mir(&mut self) {
|
||||
|
@ -355,6 +355,7 @@ define_tables! {
|
||||
inferred_outlives_of: Table<DefIndex, LazyArray<(ty::Clause<'static>, Span)>>,
|
||||
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
|
||||
associated_items_for_impl_trait_in_trait: Table<DefIndex, LazyArray<DefId>>,
|
||||
opt_rpitit_info: Table<DefIndex, Option<LazyValue<ty::ImplTraitInTraitData>>>,
|
||||
|
||||
- optional:
|
||||
attributes: Table<DefIndex, LazyArray<ast::Attribute>>,
|
||||
|
@ -63,6 +63,7 @@ trivially_parameterized_over_tcx! {
|
||||
ty::DeducedParamAttrs,
|
||||
ty::Generics,
|
||||
ty::ImplPolarity,
|
||||
ty::ImplTraitInTraitData,
|
||||
ty::ReprOptions,
|
||||
ty::TraitDef,
|
||||
ty::UnusedGenericParams,
|
||||
|
@ -119,12 +119,9 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] {
|
||||
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> {
|
||||
// When computing the param_env of an RPITIT, copy param_env of the containing function. The
|
||||
// synthesized associated type doesn't have extra predicates to assume.
|
||||
let def_id =
|
||||
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id) {
|
||||
fn_def_id
|
||||
} else {
|
||||
def_id
|
||||
};
|
||||
return tcx.param_env(fn_def_id);
|
||||
}
|
||||
|
||||
// Compute the bounds on Self and the type parameters.
|
||||
let ty::InstantiatedPredicates { mut predicates, .. } =
|
||||
|
Loading…
Reference in New Issue
Block a user