@@ -183,7 +183,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
183183 PatKind::TupleStruct(ref qpath, subpats, ddpos) => {
184184 self.check_pat_tuple_struct(pat, qpath, subpats, ddpos, expected, def_bm, ti)
185185 }
186- PatKind::Path(_) => self.check_pat_path(pat, path_res.unwrap(), expected, ti),
186+ PatKind::Path(ref qpath) => {
187+ self.check_pat_path(pat, qpath, path_res.unwrap(), expected, ti)
188+ }
187189 PatKind::Struct(ref qpath, fields, has_rest_pat) => {
188190 self.check_pat_struct(pat, qpath, fields, has_rest_pat, expected, def_bm, ti)
189191 }
@@ -800,6 +802,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
800802 fn check_pat_path<'b>(
801803 &self,
802804 pat: &Pat<'_>,
805+ qpath: &hir::QPath<'_>,
803806 path_resolution: (Res, Option<Ty<'tcx>>, &'b [hir::PathSegment<'b>]),
804807 expected: Ty<'tcx>,
805808 ti: TopInfo<'tcx>,
@@ -814,7 +817,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
814817 return tcx.ty_error();
815818 }
816819 Res::Def(DefKind::AssocFn | DefKind::Ctor(_, CtorKind::Fictive | CtorKind::Fn), _) => {
817- report_unexpected_variant_res(tcx, res, pat.span);
820+ report_unexpected_variant_res(tcx, res, qpath, pat.span);
818821 return tcx.ty_error();
819822 }
820823 Res::SelfCtor(..)
0 commit comments