@@ -50,7 +50,6 @@ use errors::Applicability;
5050use rustc_data_structures:: fx:: FxHashSet ;
5151use rustc_data_structures:: indexed_vec:: IndexVec ;
5252use rustc_data_structures:: thin_vec:: ThinVec ;
53- use rustc_data_structures:: sync:: Lrc ;
5453
5554use std:: collections:: { BTreeSet , BTreeMap } ;
5655use std:: mem;
@@ -59,10 +58,10 @@ use syntax::attr;
5958use syntax:: ast;
6059use syntax:: ast:: * ;
6160use syntax:: errors;
62- use syntax:: ext:: hygiene:: { Mark , SyntaxContext } ;
61+ use syntax:: ext:: hygiene:: Mark ;
6362use syntax:: print:: pprust;
6463use syntax:: ptr:: P ;
65- use syntax:: source_map:: { self , respan, CompilerDesugaringKind , Spanned } ;
64+ use syntax:: source_map:: { respan, CompilerDesugaringKind , Spanned } ;
6665use syntax:: std_inject;
6766use syntax:: symbol:: { keywords, Symbol } ;
6867use syntax:: tokenstream:: { TokenStream , TokenTree } ;
@@ -854,27 +853,6 @@ impl<'a> LoweringContext<'a> {
854853 Ident :: with_empty_ctxt ( Symbol :: gensym ( s) )
855854 }
856855
857- /// Reuses the span but adds information like the kind of the desugaring and features that are
858- /// allowed inside this span.
859- fn mark_span_with_reason (
860- & self ,
861- reason : CompilerDesugaringKind ,
862- span : Span ,
863- allow_internal_unstable : Option < Lrc < [ Symbol ] > > ,
864- ) -> Span {
865- let mark = Mark :: fresh ( Mark :: root ( ) ) ;
866- mark. set_expn_info ( source_map:: ExpnInfo {
867- call_site : span,
868- def_site : Some ( span) ,
869- format : source_map:: CompilerDesugaring ( reason) ,
870- allow_internal_unstable,
871- allow_internal_unsafe : false ,
872- local_inner_macros : false ,
873- edition : source_map:: hygiene:: default_edition ( ) ,
874- } ) ;
875- span. with_ctxt ( SyntaxContext :: empty ( ) . apply_mark ( mark) )
876- }
877-
878856 fn with_anonymous_lifetime_mode < R > (
879857 & mut self ,
880858 anonymous_lifetime_mode : AnonymousLifetimeMode ,
@@ -1162,7 +1140,7 @@ impl<'a> LoweringContext<'a> {
11621140 attrs : ThinVec :: new ( ) ,
11631141 } ;
11641142
1165- let unstable_span = self . mark_span_with_reason (
1143+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
11661144 CompilerDesugaringKind :: Async ,
11671145 span,
11681146 Some ( vec ! [
@@ -1569,7 +1547,7 @@ impl<'a> LoweringContext<'a> {
15691547 // desugaring that explicitly states that we don't want to track that.
15701548 // Not tracking it makes lints in rustc and clippy very fragile as
15711549 // frequently opened issues show.
1572- let exist_ty_span = self . mark_span_with_reason (
1550+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
15731551 CompilerDesugaringKind :: ExistentialReturnType ,
15741552 span,
15751553 None ,
@@ -2443,7 +2421,7 @@ impl<'a> LoweringContext<'a> {
24432421 ) -> hir:: FunctionRetTy {
24442422 let span = output. span ( ) ;
24452423
2446- let exist_ty_span = self . mark_span_with_reason (
2424+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
24472425 CompilerDesugaringKind :: Async ,
24482426 span,
24492427 None ,
@@ -4179,7 +4157,7 @@ impl<'a> LoweringContext<'a> {
41794157 } ) ,
41804158 ExprKind :: TryBlock ( ref body) => {
41814159 self . with_catch_scope ( body. id , |this| {
4182- let unstable_span = this. mark_span_with_reason (
4160+ let unstable_span = this. sess . source_map ( ) . mark_span_with_reason (
41834161 CompilerDesugaringKind :: TryBlock ,
41844162 body. span ,
41854163 Some ( vec ! [
@@ -4612,7 +4590,7 @@ impl<'a> LoweringContext<'a> {
46124590 // expand <head>
46134591 let mut head = self . lower_expr ( head) ;
46144592 let head_sp = head. span ;
4615- let desugared_span = self . mark_span_with_reason (
4593+ let desugared_span = self . sess . source_map ( ) . mark_span_with_reason (
46164594 CompilerDesugaringKind :: ForLoop ,
46174595 head_sp,
46184596 None ,
@@ -4773,15 +4751,15 @@ impl<'a> LoweringContext<'a> {
47734751 // return Try::from_error(From::from(err)),
47744752 // }
47754753
4776- let unstable_span = self . mark_span_with_reason (
4754+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
47774755 CompilerDesugaringKind :: QuestionMark ,
47784756 e. span ,
47794757 Some ( vec ! [
47804758 Symbol :: intern( "try_trait" )
47814759 ] . into ( ) ) ,
47824760 ) ;
47834761 let try_span = self . sess . source_map ( ) . end_point ( e. span ) ;
4784- let try_span = self . mark_span_with_reason (
4762+ let try_span = self . sess . source_map ( ) . mark_span_with_reason (
47854763 CompilerDesugaringKind :: QuestionMark ,
47864764 try_span,
47874765 Some ( vec ! [
@@ -5566,12 +5544,12 @@ impl<'a> LoweringContext<'a> {
55665544 ) ;
55675545 self . sess . abort_if_errors ( ) ;
55685546 }
5569- let span = self . mark_span_with_reason (
5547+ let span = self . sess . source_map ( ) . mark_span_with_reason (
55705548 CompilerDesugaringKind :: Await ,
55715549 await_span,
55725550 None ,
55735551 ) ;
5574- let gen_future_span = self . mark_span_with_reason (
5552+ let gen_future_span = self . sess . source_map ( ) . mark_span_with_reason (
55755553 CompilerDesugaringKind :: Await ,
55765554 await_span,
55775555 Some ( vec ! [ Symbol :: intern( "gen_future" ) ] . into ( ) ) ,
0 commit comments