Rename projection_def_id to item_def_id

This commit is contained in:
Michael Goulet 2024-12-11 00:59:39 +00:00
parent 33c245b9e9
commit ec68498317
7 changed files with 9 additions and 9 deletions

View file

@ -203,7 +203,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// corresponding `Projection` clause // corresponding `Projection` clause
for def_ids in associated_types.values_mut() { for def_ids in associated_types.values_mut() {
for (projection_bound, span) in &projection_bounds { for (projection_bound, span) in &projection_bounds {
let def_id = projection_bound.projection_def_id(); let def_id = projection_bound.item_def_id();
def_ids.swap_remove(&def_id); def_ids.swap_remove(&def_id);
if tcx.generics_require_sized_self(def_id) { if tcx.generics_require_sized_self(def_id) {
tcx.emit_node_span_lint( tcx.emit_node_span_lint(
@ -413,7 +413,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
late_bound_in_projection_term, late_bound_in_projection_term,
late_bound_in_term, late_bound_in_term,
|br_name| { |br_name| {
let item_name = tcx.item_name(pred.projection_def_id()); let item_name = tcx.item_name(pred.item_def_id());
struct_span_code_err!( struct_span_code_err!(
self.dcx(), self.dcx(),
span, span,

View file

@ -454,7 +454,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
closure_kind: hir::ClosureKind, closure_kind: hir::ClosureKind,
projection: ty::PolyProjectionPredicate<'tcx>, projection: ty::PolyProjectionPredicate<'tcx>,
) -> Option<ExpectedSig<'tcx>> { ) -> Option<ExpectedSig<'tcx>> {
let def_id = projection.projection_def_id(); let def_id = projection.item_def_id();
// For now, we only do signature deduction based off of the `Fn` and `AsyncFn` traits, // For now, we only do signature deduction based off of the `Fn` and `AsyncFn` traits,
// for closures and async closures, respectively. // for closures and async closures, respectively.

View file

@ -1020,7 +1020,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
self.insert_trait_and_projection( self.insert_trait_and_projection(
trait_ref, trait_ref,
Some((proj.projection_def_id(), proj.term())), Some((proj.item_def_id(), proj.term())),
&mut traits, &mut traits,
&mut fn_traits, &mut fn_traits,
); );

View file

@ -144,7 +144,7 @@ where
then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult<I>, then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult<I>,
) -> Result<Candidate<I>, NoSolution> { ) -> Result<Candidate<I>, NoSolution> {
if let Some(projection_pred) = assumption.as_projection_clause() { if let Some(projection_pred) = assumption.as_projection_clause() {
if projection_pred.projection_def_id() == goal.predicate.def_id() { if projection_pred.item_def_id() == goal.predicate.def_id() {
let cx = ecx.cx(); let cx = ecx.cx();
if !DeepRejectCtxt::relate_rigid_rigid(ecx.cx()).args_may_unify( if !DeepRejectCtxt::relate_rigid_rigid(ecx.cx()).args_may_unify(
goal.predicate.alias.args, goal.predicate.alias.args,

View file

@ -744,7 +744,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>(
let Some(clause) = clause.as_projection_clause() else { let Some(clause) = clause.as_projection_clause() else {
return ControlFlow::Continue(()); return ControlFlow::Continue(());
}; };
if clause.projection_def_id() != obligation.predicate.def_id { if clause.item_def_id() != obligation.predicate.def_id {
return ControlFlow::Continue(()); return ControlFlow::Continue(());
} }
@ -847,7 +847,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
let bound_predicate = predicate.kind(); let bound_predicate = predicate.kind();
if let ty::ClauseKind::Projection(data) = predicate.kind().skip_binder() { if let ty::ClauseKind::Projection(data) = predicate.kind().skip_binder() {
let data = bound_predicate.rebind(data); let data = bound_predicate.rebind(data);
if data.projection_def_id() != obligation.predicate.def_id { if data.item_def_id() != obligation.predicate.def_id {
continue; continue;
} }

View file

@ -1737,7 +1737,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
env_predicate: PolyProjectionPredicate<'tcx>, env_predicate: PolyProjectionPredicate<'tcx>,
potentially_unnormalized_candidates: bool, potentially_unnormalized_candidates: bool,
) -> ProjectionMatchesProjection { ) -> ProjectionMatchesProjection {
debug_assert_eq!(obligation.predicate.def_id, env_predicate.projection_def_id()); debug_assert_eq!(obligation.predicate.def_id, env_predicate.item_def_id());
let mut nested_obligations = PredicateObligations::new(); let mut nested_obligations = PredicateObligations::new();
let infer_predicate = self.infcx.instantiate_binder_with_fresh_vars( let infer_predicate = self.infcx.instantiate_binder_with_fresh_vars(

View file

@ -692,7 +692,7 @@ impl<I: Interner> ty::Binder<I, ProjectionPredicate<I>> {
/// ///
/// Note that this is not the `DefId` of the `TraitRef` containing this /// Note that this is not the `DefId` of the `TraitRef` containing this
/// associated type, which is in `tcx.associated_item(projection_def_id()).container`. /// associated type, which is in `tcx.associated_item(projection_def_id()).container`.
pub fn projection_def_id(&self) -> I::DefId { pub fn item_def_id(&self) -> I::DefId {
// Ok to skip binder since trait `DefId` does not care about regions. // Ok to skip binder since trait `DefId` does not care about regions.
self.skip_binder().projection_term.def_id self.skip_binder().projection_term.def_id
} }