@@ -60,10 +60,9 @@ use syntax::attr;
6060use syntax:: ast;
6161use syntax:: ast:: * ;
6262use syntax:: errors;
63- use syntax:: ext:: hygiene:: { Mark , SyntaxContext } ;
63+ use syntax:: ext:: hygiene:: Mark ;
6464use syntax:: print:: pprust;
65- use syntax:: source_map:: { self , respan, ExpnInfo , CompilerDesugaringKind , Spanned } ;
66- use syntax:: source_map:: CompilerDesugaringKind :: CondTemporary ;
65+ use syntax:: source_map:: { respan, ExpnInfo , ExpnKind , DesugaringKind , Spanned } ;
6766use syntax:: std_inject;
6867use syntax:: symbol:: { kw, sym, Symbol } ;
6968use syntax:: tokenstream:: { TokenStream , TokenTree } ;
@@ -872,17 +871,15 @@ impl<'a> LoweringContext<'a> {
872871 /// allowed inside this span.
873872 fn mark_span_with_reason (
874873 & self ,
875- reason : CompilerDesugaringKind ,
874+ reason : DesugaringKind ,
876875 span : Span ,
877876 allow_internal_unstable : Option < Lrc < [ Symbol ] > > ,
878877 ) -> Span {
879- let mark = Mark :: fresh ( Mark :: root ( ) ) ;
880- mark. set_expn_info ( ExpnInfo {
881- def_site : Some ( span) ,
878+ span. fresh_expansion ( Mark :: root ( ) , ExpnInfo {
879+ def_site : span,
882880 allow_internal_unstable,
883- ..ExpnInfo :: default ( source_map:: CompilerDesugaring ( reason) , span, self . sess . edition ( ) )
884- } ) ;
885- span. with_ctxt ( SyntaxContext :: empty ( ) . apply_mark ( mark) )
881+ ..ExpnInfo :: default ( ExpnKind :: Desugaring ( reason) , span, self . sess . edition ( ) )
882+ } )
886883 }
887884
888885 fn with_anonymous_lifetime_mode < R > (
@@ -1188,7 +1185,7 @@ impl<'a> LoweringContext<'a> {
11881185 } ;
11891186
11901187 let unstable_span = self . mark_span_with_reason (
1191- CompilerDesugaringKind :: Async ,
1188+ DesugaringKind :: Async ,
11921189 span,
11931190 self . allow_gen_future . clone ( ) ,
11941191 ) ;
@@ -1733,7 +1730,7 @@ impl<'a> LoweringContext<'a> {
17331730 // Not tracking it makes lints in rustc and clippy very fragile, as
17341731 // frequently opened issues show.
17351732 let exist_ty_span = self . mark_span_with_reason (
1736- CompilerDesugaringKind :: ExistentialType ,
1733+ DesugaringKind :: ExistentialType ,
17371734 span,
17381735 None ,
17391736 ) ;
@@ -2603,7 +2600,7 @@ impl<'a> LoweringContext<'a> {
26032600 let span = output. span ( ) ;
26042601
26052602 let exist_ty_span = self . mark_span_with_reason (
2606- CompilerDesugaringKind :: Async ,
2603+ DesugaringKind :: Async ,
26072604 span,
26082605 None ,
26092606 ) ;
@@ -3275,7 +3272,7 @@ impl<'a> LoweringContext<'a> {
32753272 } ;
32763273
32773274 let desugared_span =
3278- this. mark_span_with_reason ( CompilerDesugaringKind :: Async , span, None ) ;
3275+ this. mark_span_with_reason ( DesugaringKind :: Async , span, None ) ;
32793276
32803277 // Construct an argument representing `__argN: <ty>` to replace the argument of the
32813278 // async function.
@@ -4410,7 +4407,9 @@ impl<'a> LoweringContext<'a> {
44104407 _ => {
44114408 // Lower condition:
44124409 let cond = self . lower_expr ( cond) ;
4413- let span_block = self . mark_span_with_reason ( CondTemporary , cond. span , None ) ;
4410+ let span_block = self . mark_span_with_reason (
4411+ DesugaringKind :: CondTemporary , cond. span , None
4412+ ) ;
44144413 // Wrap in a construct equivalent to `{ let _t = $cond; _t }`
44154414 // to preserve drop semantics since `if cond { ... }` does not
44164415 // let temporaries live outside of `cond`.
@@ -4469,7 +4468,9 @@ impl<'a> LoweringContext<'a> {
44694468
44704469 // Lower condition:
44714470 let cond = this. with_loop_condition_scope ( |this| this. lower_expr ( cond) ) ;
4472- let span_block = this. mark_span_with_reason ( CondTemporary , cond. span , None ) ;
4471+ let span_block = this. mark_span_with_reason (
4472+ DesugaringKind :: CondTemporary , cond. span , None
4473+ ) ;
44734474 // Wrap in a construct equivalent to `{ let _t = $cond; _t }`
44744475 // to preserve drop semantics since `while cond { ... }` does not
44754476 // let temporaries live outside of `cond`.
@@ -4508,7 +4509,7 @@ impl<'a> LoweringContext<'a> {
45084509 ExprKind :: TryBlock ( ref body) => {
45094510 self . with_catch_scope ( body. id , |this| {
45104511 let unstable_span = this. mark_span_with_reason (
4511- CompilerDesugaringKind :: TryBlock ,
4512+ DesugaringKind :: TryBlock ,
45124513 body. span ,
45134514 this. allow_try_trait . clone ( ) ,
45144515 ) ;
@@ -4836,7 +4837,7 @@ impl<'a> LoweringContext<'a> {
48364837 let mut head = self . lower_expr ( head) ;
48374838 let head_sp = head. span ;
48384839 let desugared_span = self . mark_span_with_reason (
4839- CompilerDesugaringKind :: ForLoop ,
4840+ DesugaringKind :: ForLoop ,
48404841 head_sp,
48414842 None ,
48424843 ) ;
@@ -4990,13 +4991,13 @@ impl<'a> LoweringContext<'a> {
49904991 // }
49914992
49924993 let unstable_span = self . mark_span_with_reason (
4993- CompilerDesugaringKind :: QuestionMark ,
4994+ DesugaringKind :: QuestionMark ,
49944995 e. span ,
49954996 self . allow_try_trait . clone ( ) ,
49964997 ) ;
49974998 let try_span = self . sess . source_map ( ) . end_point ( e. span ) ;
49984999 let try_span = self . mark_span_with_reason (
4999- CompilerDesugaringKind :: QuestionMark ,
5000+ DesugaringKind :: QuestionMark ,
50005001 try_span,
50015002 self . allow_try_trait . clone ( ) ,
50025003 ) ;
@@ -5811,12 +5812,12 @@ impl<'a> LoweringContext<'a> {
58115812 }
58125813 }
58135814 let span = self . mark_span_with_reason (
5814- CompilerDesugaringKind :: Await ,
5815+ DesugaringKind :: Await ,
58155816 await_span,
58165817 None ,
58175818 ) ;
58185819 let gen_future_span = self . mark_span_with_reason (
5819- CompilerDesugaringKind :: Await ,
5820+ DesugaringKind :: Await ,
58205821 await_span,
58215822 self . allow_gen_future . clone ( ) ,
58225823 ) ;
0 commit comments