Skip to content

Commit

Permalink
Rename projection_def_id to item_def_id
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 11, 2024
1 parent 33c245b commit ec68498
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
closure_kind: hir::ClosureKind,
projection: ty::PolyProjectionPredicate<'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 closures and async closures, respectively.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
then: impl FnOnce(&mut EvalCtxt<'_, D>) -> QueryResult<I>,
) -> Result<Candidate<I>, 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,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ impl<I: Interner> ty::Binder<I, ProjectionPredicate<I>> {
///
/// 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
}
Expand Down

0 comments on commit ec68498

Please sign in to comment.