@@ -279,7 +279,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
279279 self . check_pat_tuple_struct ( pat, qpath, subpats, ddpos, expected, pat_info)
280280 }
281281 PatKind :: Path ( ref qpath) => {
282- self . check_pat_path ( pat, qpath, path_res. unwrap ( ) , expected, ti)
282+ self . check_pat_path ( pat. hir_id , pat . span , qpath, path_res. unwrap ( ) , expected, ti)
283283 }
284284 PatKind :: Struct ( ref qpath, fields, has_rest_pat) => {
285285 self . check_pat_struct ( pat, qpath, fields, has_rest_pat, expected, pat_info)
@@ -1053,7 +1053,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10531053
10541054 fn check_pat_path (
10551055 & self ,
1056- pat : & Pat < ' tcx > ,
1056+ hir_id : HirId ,
1057+ span : Span ,
10571058 qpath : & hir:: QPath < ' _ > ,
10581059 path_resolution : ( Res , Option < LoweredTy < ' tcx > > , & ' tcx [ hir:: PathSegment < ' tcx > ] ) ,
10591060 expected : Ty < ' tcx > ,
@@ -1072,8 +1073,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10721073 }
10731074 Res :: Def ( DefKind :: AssocFn | DefKind :: Ctor ( _, CtorKind :: Fn ) | DefKind :: Variant , _) => {
10741075 let expected = "unit struct, unit variant or constant" ;
1075- let e =
1076- report_unexpected_variant_res ( tcx, res, None , qpath, pat. span , E0533 , expected) ;
1076+ let e = report_unexpected_variant_res ( tcx, res, None , qpath, span, E0533 , expected) ;
10771077 return Ty :: new_error ( tcx, e) ;
10781078 }
10791079 Res :: SelfCtor ( def_id) => {
@@ -1088,7 +1088,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10881088 res,
10891089 None ,
10901090 qpath,
1091- pat . span ,
1091+ span,
10921092 E0533 ,
10931093 "unit struct" ,
10941094 ) ;
@@ -1107,11 +1107,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11071107
11081108 // Type-check the path.
11091109 let ( pat_ty, pat_res) =
1110- self . instantiate_value_path ( segments, opt_ty, res, pat . span , pat . span , pat . hir_id ) ;
1110+ self . instantiate_value_path ( segments, opt_ty, res, span, span, hir_id) ;
11111111 if let Err ( err) =
1112- self . demand_suptype_with_origin ( & self . pattern_cause ( ti, pat . span ) , expected, pat_ty)
1112+ self . demand_suptype_with_origin ( & self . pattern_cause ( ti, span) , expected, pat_ty)
11131113 {
1114- self . emit_bad_pat_path ( err, pat , res, pat_res, pat_ty, segments) ;
1114+ self . emit_bad_pat_path ( err, hir_id , span , res, pat_res, pat_ty, segments) ;
11151115 }
11161116 pat_ty
11171117 }
@@ -1154,13 +1154,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11541154 fn emit_bad_pat_path (
11551155 & self ,
11561156 mut e : Diag < ' _ > ,
1157- pat : & hir:: Pat < ' tcx > ,
1157+ hir_id : HirId ,
1158+ pat_span : Span ,
11581159 res : Res ,
11591160 pat_res : Res ,
11601161 pat_ty : Ty < ' tcx > ,
11611162 segments : & ' tcx [ hir:: PathSegment < ' tcx > ] ,
11621163 ) {
1163- let pat_span = pat. span ;
11641164 if let Some ( span) = self . tcx . hir ( ) . res_span ( pat_res) {
11651165 e. span_label ( span, format ! ( "{} defined here" , res. descr( ) ) ) ;
11661166 if let [ hir:: PathSegment { ident, .. } ] = & * segments {
@@ -1173,7 +1173,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11731173 res. descr( ) ,
11741174 ) ,
11751175 ) ;
1176- match self . tcx . parent_hir_node ( pat . hir_id ) {
1176+ match self . tcx . parent_hir_node ( hir_id) {
11771177 hir:: Node :: PatField ( ..) => {
11781178 e. span_suggestion_verbose (
11791179 ident. span . shrink_to_hi ( ) ,
0 commit comments