@@ -1523,7 +1523,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
15231523 fn lower_expr_range_closed ( & mut self , span : Span , e1 : & Expr , e2 : & Expr ) -> hir:: ExprKind < ' hir > {
15241524 let e1 = self . lower_expr_mut ( e1) ;
15251525 let e2 = self . lower_expr_mut ( e2) ;
1526- let fn_path = hir:: QPath :: LangItem ( hir:: LangItem :: RangeInclusiveNew , self . lower_span ( span) ) ;
1526+ let span = self . mark_span_with_reason ( DesugaringKind :: Range , self . lower_span ( span) , None ) ;
1527+ let fn_path = hir:: QPath :: LangItem ( hir:: LangItem :: RangeInclusiveNew , span) ;
15271528 let fn_expr = self . arena . alloc ( self . expr ( span, hir:: ExprKind :: Path ( fn_path) ) ) ;
15281529 hir:: ExprKind :: Call ( fn_expr, arena_vec ! [ self ; e1, e2] )
15291530 }
@@ -1581,14 +1582,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
15811582 e1. iter ( ) . map ( |e| ( sym:: start, e) ) . chain ( e2. iter ( ) . map ( |e| ( sym:: end, e) ) ) . map (
15821583 |( s, e) | {
15831584 let expr = self . lower_expr ( e) ;
1584- let ident = Ident :: new ( s, self . lower_span ( e. span ) ) ;
1585- self . expr_field ( ident, expr, e. span )
1585+ let field_span = self . mark_span_with_reason (
1586+ DesugaringKind :: Range ,
1587+ self . lower_span ( e. span ) ,
1588+ None ,
1589+ ) ;
1590+ let ident = Ident :: new ( s, field_span) ;
1591+ self . expr_field ( ident, expr, field_span)
15861592 } ,
15871593 ) ,
15881594 ) ;
15891595
1596+ let struct_span =
1597+ self . mark_span_with_reason ( DesugaringKind :: Range , self . lower_span ( span) , None ) ;
15901598 hir:: ExprKind :: Struct (
1591- self . arena . alloc ( hir:: QPath :: LangItem ( lang_item, self . lower_span ( span ) ) ) ,
1599+ self . arena . alloc ( hir:: QPath :: LangItem ( lang_item, struct_span ) ) ,
15921600 fields,
15931601 hir:: StructTailExpr :: None ,
15941602 )
@@ -2299,16 +2307,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
22992307 hir:: Expr { hir_id, kind, span : self . lower_span ( span) }
23002308 }
23012309
2302- pub ( super ) fn expr_field (
2310+ fn expr_field (
23032311 & mut self ,
23042312 ident : Ident ,
23052313 expr : & ' hir hir:: Expr < ' hir > ,
2306- span : Span ,
2314+ lowered_span : Span ,
23072315 ) -> hir:: ExprField < ' hir > {
23082316 hir:: ExprField {
23092317 hir_id : self . next_id ( ) ,
23102318 ident,
2311- span : self . lower_span ( span ) ,
2319+ span : lowered_span ,
23122320 expr,
23132321 is_shorthand : false ,
23142322 }
0 commit comments