From ec68498317f90221eeca4c5a14593914b42c2d0e Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 11 Dec 2024 00:59:39 +0000 Subject: [PATCH] Rename projection_def_id to item_def_id --- .../src/hir_ty_lowering/dyn_compatibility.rs | 4 ++-- compiler/rustc_hir_typeck/src/closure.rs | 2 +- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- .../rustc_next_trait_solver/src/solve/normalizes_to/mod.rs | 2 +- compiler/rustc_trait_selection/src/traits/project.rs | 4 ++-- compiler/rustc_trait_selection/src/traits/select/mod.rs | 2 +- compiler/rustc_type_ir/src/predicate.rs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs index 321a8aba7f727..d3c86989440e6 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs @@ -203,7 +203,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { // corresponding `Projection` clause for def_ids in associated_types.values_mut() { 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); if tcx.generics_require_sized_self(def_id) { tcx.emit_node_span_lint( @@ -413,7 +413,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { late_bound_in_projection_term, late_bound_in_term, |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!( self.dcx(), span, diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index 9037caf0066fe..b8652d82d91bc 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -454,7 +454,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { closure_kind: hir::ClosureKind, projection: ty::PolyProjectionPredicate<'tcx>, ) -> Option> { - 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 closures and async closures, respectively. diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index cd4123f0a3f56..40e0fb0087f54 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1020,7 +1020,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { self.insert_trait_and_projection( trait_ref, - Some((proj.projection_def_id(), proj.term())), + Some((proj.item_def_id(), proj.term())), &mut traits, &mut fn_traits, ); diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs index f5b1b23b8e973..63dbee2640bff 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs @@ -144,7 +144,7 @@ where then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult, ) -> Result, NoSolution> { 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(); if !DeepRejectCtxt::relate_rigid_rigid(ecx.cx()).args_may_unify( goal.predicate.alias.args, diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 49c34550f8e03..541c0c915ffd7 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -744,7 +744,7 @@ fn assemble_candidates_from_trait_def<'cx, 'tcx>( let Some(clause) = clause.as_projection_clause() else { return ControlFlow::Continue(()); }; - if clause.projection_def_id() != obligation.predicate.def_id { + if clause.item_def_id() != obligation.predicate.def_id { return ControlFlow::Continue(()); } @@ -847,7 +847,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>( let bound_predicate = predicate.kind(); if let ty::ClauseKind::Projection(data) = predicate.kind().skip_binder() { 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; } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index d362866cbc38d..25fe43e3a0e6f 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1737,7 +1737,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { env_predicate: PolyProjectionPredicate<'tcx>, potentially_unnormalized_candidates: bool, ) -> 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 infer_predicate = self.infcx.instantiate_binder_with_fresh_vars( diff --git a/compiler/rustc_type_ir/src/predicate.rs b/compiler/rustc_type_ir/src/predicate.rs index 4213ef4803be2..9a80f97e274d2 100644 --- a/compiler/rustc_type_ir/src/predicate.rs +++ b/compiler/rustc_type_ir/src/predicate.rs @@ -692,7 +692,7 @@ impl ty::Binder> { /// /// Note that this is not the `DefId` of the `TraitRef` containing this /// 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. self.skip_binder().projection_term.def_id }