Skip to content

Commit 112d5e4

Browse files
committed
WIP
1 parent 41a79f1 commit 112d5e4

File tree

5 files changed

+310
-233
lines changed

5 files changed

+310
-233
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
@@ -559,6 +559,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
559559
constraint.ident,
560560
path_span,
561561
Some(constraint),
562+
)
563+
.select_bound(
564+
self,
565+
AssocItemQSelf::Trait(trait_ref.def_id()),
566+
assoc_tag,
567+
constraint.ident,
568+
path_span,
569+
Some(constraint),
562570
)?
563571
};
564572

@@ -806,42 +814,46 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
806814
}) =>
807815
{
808816
let self_ty = self.lower_ty(hir_self_ty);
809-
let (item_def_id, bound) = match self.resolve_type_relative_path(
810-
self_ty,
811-
hir_self_ty,
812-
ty::AssocTag::Fn,
813-
segment,
814-
hir_ty.hir_id,
815-
hir_ty.span,
816-
None,
817-
) {
818-
Ok(result) => result,
819-
Err(guar) => return Ty::new_error(tcx, guar),
820-
};
817+
818+
// FIXME(unresolved_aliases): Force a resolution here
819+
todo!()
820+
821+
// let (item_def_id, bound) = match self.resolve_type_relative_path(
822+
// self_ty,
823+
// hir_self_ty,
824+
// ty::AssocTag::Fn,
825+
// segment,
826+
// hir_ty.hir_id,
827+
// hir_ty.span,
828+
// None,
829+
// ) {
830+
// Ok(result) => result,
831+
// Err(guar) => return Ty::new_error(tcx, guar),
832+
// };
821833

822834
// Don't let `T::method` resolve to some `for<'a> <T as Tr<'a>>::method`,
823835
// which may happen via a higher-ranked where clause or supertrait.
824836
// This is the same restrictions as associated types; even though we could
825837
// support it, it just makes things a lot more difficult to support in
826838
// `resolve_bound_vars`, since we'd need to introduce those as elided
827839
// bound vars on the where clause too.
828-
if bound.has_bound_vars() {
829-
return Ty::new_error(
830-
tcx,
831-
self.dcx().emit_err(errors::AssociatedItemTraitUninferredGenericParams {
832-
span: hir_ty.span,
833-
inferred_sugg: Some(hir_ty.span.with_hi(segment.ident.span.lo())),
834-
bound: format!("{}::", tcx.anonymize_bound_vars(bound).skip_binder()),
835-
mpart_sugg: None,
836-
what: tcx.def_descr(item_def_id),
837-
}),
838-
);
839-
}
840-
841-
match self.lower_return_type_notation_ty(bound, item_def_id, hir_ty.span) {
842-
Ok(ty) => Ty::new_alias(tcx, ty::Projection, ty),
843-
Err(guar) => Ty::new_error(tcx, guar),
844-
}
840+
// if bound.has_bound_vars() {
841+
// return Ty::new_error(
842+
// tcx,
843+
// self.dcx().emit_err(errors::AssociatedItemTraitUninferredGenericParams {
844+
// span: hir_ty.span,
845+
// inferred_sugg: Some(hir_ty.span.with_hi(segment.ident.span.lo())),
846+
// bound: format!("{}::", tcx.anonymize_bound_vars(bound).skip_binder()),
847+
// mpart_sugg: None,
848+
// what: tcx.def_descr(item_def_id),
849+
// }),
850+
// );
851+
// }
852+
853+
// match self.lower_return_type_notation_ty(bound, item_def_id, hir_ty.span) {
854+
// Ok(ty) => Ty::new_alias(tcx, ty::Projection, ty),
855+
// Err(guar) => Ty::new_error(tcx, guar),
856+
// }
845857
}
846858
_ => self.lower_ty(hir_ty),
847859
}

0 commit comments

Comments
 (0)