Skip to content

Commit 017d868

Browse files
committed
WIP
1 parent 915e535 commit 017d868

File tree

5 files changed

+311
-232
lines changed

5 files changed

+311
-232
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
574574
constraint.ident,
575575
path_span,
576576
Some(constraint),
577+
)
578+
.select_bound(
579+
self,
580+
AssocItemQSelf::Trait(trait_ref.def_id()),
581+
assoc_tag,
582+
constraint.ident,
583+
path_span,
584+
Some(constraint),
577585
)?
578586
};
579587

@@ -825,42 +833,46 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
825833
}) =>
826834
{
827835
let self_ty = self.lower_ty(hir_self_ty);
828-
let (item_def_id, bound) = match self.resolve_type_relative_path(
829-
self_ty,
830-
hir_self_ty,
831-
ty::AssocTag::Fn,
832-
segment,
833-
hir_ty.hir_id,
834-
hir_ty.span,
835-
None,
836-
) {
837-
Ok(result) => result,
838-
Err(guar) => return Ty::new_error(tcx, guar),
839-
};
836+
837+
// FIXME(unresolved_aliases): Force a resolution here
838+
todo!()
839+
840+
// let (item_def_id, bound) = match self.resolve_type_relative_path(
841+
// self_ty,
842+
// hir_self_ty,
843+
// ty::AssocTag::Fn,
844+
// segment,
845+
// hir_ty.hir_id,
846+
// hir_ty.span,
847+
// None,
848+
// ) {
849+
// Ok(result) => result,
850+
// Err(guar) => return Ty::new_error(tcx, guar),
851+
// };
840852

841853
// Don't let `T::method` resolve to some `for<'a> <T as Tr<'a>>::method`,
842854
// which may happen via a higher-ranked where clause or supertrait.
843855
// This is the same restrictions as associated types; even though we could
844856
// support it, it just makes things a lot more difficult to support in
845857
// `resolve_bound_vars`, since we'd need to introduce those as elided
846858
// bound vars on the where clause too.
847-
if bound.has_bound_vars() {
848-
return Ty::new_error(
849-
tcx,
850-
self.dcx().emit_err(errors::AssociatedItemTraitUninferredGenericParams {
851-
span: hir_ty.span,
852-
inferred_sugg: Some(hir_ty.span.with_hi(segment.ident.span.lo())),
853-
bound: format!("{}::", tcx.anonymize_bound_vars(bound).skip_binder()),
854-
mpart_sugg: None,
855-
what: tcx.def_descr(item_def_id),
856-
}),
857-
);
858-
}
859-
860-
match self.lower_return_type_notation_ty(bound, item_def_id, hir_ty.span) {
861-
Ok(ty) => Ty::new_alias(tcx, ty::Projection, ty),
862-
Err(guar) => Ty::new_error(tcx, guar),
863-
}
859+
// if bound.has_bound_vars() {
860+
// return Ty::new_error(
861+
// tcx,
862+
// self.dcx().emit_err(errors::AssociatedItemTraitUninferredGenericParams {
863+
// span: hir_ty.span,
864+
// inferred_sugg: Some(hir_ty.span.with_hi(segment.ident.span.lo())),
865+
// bound: format!("{}::", tcx.anonymize_bound_vars(bound).skip_binder()),
866+
// mpart_sugg: None,
867+
// what: tcx.def_descr(item_def_id),
868+
// }),
869+
// );
870+
// }
871+
872+
// match self.lower_return_type_notation_ty(bound, item_def_id, hir_ty.span) {
873+
// Ok(ty) => Ty::new_alias(tcx, ty::Projection, ty),
874+
// Err(guar) => Ty::new_error(tcx, guar),
875+
// }
864876
}
865877
_ => self.lower_ty(hir_ty),
866878
}

0 commit comments

Comments
 (0)