ProjectionTy.item_def_id -> ProjectionTy.def_id

This commit is contained in:
Michael Goulet
2022-11-26 21:21:20 +00:00
parent 7f3af72606
commit 5c6afb850c
50 changed files with 164 additions and 186 deletions

View File

@@ -443,7 +443,7 @@ impl<'tcx> TyCtxt<'tcx> {
diag.note("an associated type was expected, but a different one was found");
}
(ty::Param(p), ty::Projection(proj)) | (ty::Projection(proj), ty::Param(p))
if self.def_kind(proj.item_def_id) != DefKind::ImplTraitPlaceholder =>
if self.def_kind(proj.def_id) != DefKind::ImplTraitPlaceholder =>
{
let generics = self.generics_of(body_owner_def_id);
let p_span = self.def_span(generics.type_param(p, self).def_id);
@@ -466,7 +466,7 @@ impl<'tcx> TyCtxt<'tcx> {
let (trait_ref, assoc_substs) = proj.trait_ref_and_own_substs(self);
let path =
self.def_path_str_with_substs(trait_ref.def_id, trait_ref.substs);
let item_name = self.item_name(proj.item_def_id);
let item_name = self.item_name(proj.def_id);
let item_args = self.format_generic_args(assoc_substs);
let path = if path.ends_with('>') {
@@ -553,7 +553,7 @@ impl<T> Trait<T> for X {
diag.span_label(p_span, "this type parameter");
}
}
(ty::Projection(proj_ty), _) if self.def_kind(proj_ty.item_def_id) != DefKind::ImplTraitPlaceholder => {
(ty::Projection(proj_ty), _) if self.def_kind(proj_ty.def_id) != DefKind::ImplTraitPlaceholder => {
self.expected_projection(
diag,
proj_ty,
@@ -562,7 +562,7 @@ impl<T> Trait<T> for X {
cause.code(),
);
}
(_, ty::Projection(proj_ty)) if self.def_kind(proj_ty.item_def_id) != DefKind::ImplTraitPlaceholder => {
(_, ty::Projection(proj_ty)) if self.def_kind(proj_ty.def_id) != DefKind::ImplTraitPlaceholder => {
let msg = format!(
"consider constraining the associated type `{}` to `{}`",
values.found, values.expected,
@@ -627,7 +627,7 @@ impl<T> Trait<T> for X {
proj_ty: &ty::ProjectionTy<'tcx>,
ty: Ty<'tcx>,
) -> bool {
let assoc = self.associated_item(proj_ty.item_def_id);
let assoc = self.associated_item(proj_ty.def_id);
let (trait_ref, assoc_substs) = proj_ty.trait_ref_and_own_substs(self);
if let Some(item) = self.hir().get_if_local(body_owner_def_id) {
if let Some(hir_generics) = item.generics() {
@@ -703,7 +703,7 @@ impl<T> Trait<T> for X {
);
let impl_comparison =
matches!(cause_code, ObligationCauseCode::CompareImplItemObligation { .. });
let assoc = self.associated_item(proj_ty.item_def_id);
let assoc = self.associated_item(proj_ty.def_id);
if !callable_scope || impl_comparison {
// We do not want to suggest calling functions when the reason of the
// type error is a comparison of an `impl` with its `trait` or when the
@@ -716,7 +716,7 @@ impl<T> Trait<T> for X {
diag,
assoc.container_id(self),
current_method_ident,
proj_ty.item_def_id,
proj_ty.def_id,
values.expected,
);
// Possibly suggest constraining the associated type to conform to the
@@ -778,7 +778,7 @@ fn foo(&self) -> Self::T { String::new() }
proj_ty: &ty::ProjectionTy<'tcx>,
ty: Ty<'tcx>,
) -> bool {
let assoc = self.associated_item(proj_ty.item_def_id);
let assoc = self.associated_item(proj_ty.def_id);
if let ty::Opaque(ty::OpaqueTy { def_id, substs: _ }) = *proj_ty.self_ty().kind() {
let opaque_local_def_id = def_id.as_local();
let opaque_hir_ty = if let Some(opaque_local_def_id) = opaque_local_def_id {
@@ -828,7 +828,7 @@ fn foo(&self) -> Self::T { String::new() }
.filter_map(|(_, item)| {
let method = self.fn_sig(item.def_id);
match *method.output().skip_binder().kind() {
ty::Projection(ty::ProjectionTy { item_def_id, .. })
ty::Projection(ty::ProjectionTy { def_id: item_def_id, .. })
if item_def_id == proj_ty_item_def_id =>
{
Some((