@@ -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 } ;
@@ -855,27 +854,6 @@ impl<'a> LoweringContext<'a> {
855854 Ident :: with_empty_ctxt ( Symbol :: gensym ( s) )
856855 }
857856
858- /// Reuses the span but adds information like the kind of the desugaring and features that are
859- /// allowed inside this span.
860- fn mark_span_with_reason (
861- & self ,
862- reason : CompilerDesugaringKind ,
863- span : Span ,
864- allow_internal_unstable : Option < Lrc < [ Symbol ] > > ,
865- ) -> Span {
866- let mark = Mark :: fresh ( Mark :: root ( ) ) ;
867- mark. set_expn_info ( source_map:: ExpnInfo {
868- call_site : span,
869- def_site : Some ( span) ,
870- format : source_map:: CompilerDesugaring ( reason) ,
871- allow_internal_unstable,
872- allow_internal_unsafe : false ,
873- local_inner_macros : false ,
874- edition : source_map:: hygiene:: default_edition ( ) ,
875- } ) ;
876- span. with_ctxt ( SyntaxContext :: empty ( ) . apply_mark ( mark) )
877- }
878-
879857 fn with_anonymous_lifetime_mode < R > (
880858 & mut self ,
881859 anonymous_lifetime_mode : AnonymousLifetimeMode ,
@@ -1164,7 +1142,7 @@ impl<'a> LoweringContext<'a> {
11641142 attrs : ThinVec :: new ( ) ,
11651143 } ;
11661144
1167- let unstable_span = self . mark_span_with_reason (
1145+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
11681146 CompilerDesugaringKind :: Async ,
11691147 span,
11701148 Some ( vec ! [
@@ -1571,7 +1549,7 @@ impl<'a> LoweringContext<'a> {
15711549 // desugaring that explicitly states that we don't want to track that.
15721550 // Not tracking it makes lints in rustc and clippy very fragile as
15731551 // frequently opened issues show.
1574- let exist_ty_span = self . mark_span_with_reason (
1552+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
15751553 CompilerDesugaringKind :: ExistentialReturnType ,
15761554 span,
15771555 None ,
@@ -2446,7 +2424,7 @@ impl<'a> LoweringContext<'a> {
24462424 ) -> hir:: FunctionRetTy {
24472425 let span = output. span ( ) ;
24482426
2449- let exist_ty_span = self . mark_span_with_reason (
2427+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
24502428 CompilerDesugaringKind :: Async ,
24512429 span,
24522430 None ,
@@ -4182,7 +4160,7 @@ impl<'a> LoweringContext<'a> {
41824160 } ) ,
41834161 ExprKind :: TryBlock ( ref body) => {
41844162 self . with_catch_scope ( body. id , |this| {
4185- let unstable_span = this. mark_span_with_reason (
4163+ let unstable_span = this. sess . source_map ( ) . mark_span_with_reason (
41864164 CompilerDesugaringKind :: TryBlock ,
41874165 body. span ,
41884166 Some ( vec ! [
@@ -4615,7 +4593,7 @@ impl<'a> LoweringContext<'a> {
46154593 // expand <head>
46164594 let mut head = self . lower_expr ( head) ;
46174595 let head_sp = head. span ;
4618- let desugared_span = self . mark_span_with_reason (
4596+ let desugared_span = self . sess . source_map ( ) . mark_span_with_reason (
46194597 CompilerDesugaringKind :: ForLoop ,
46204598 head_sp,
46214599 None ,
@@ -4776,15 +4754,15 @@ impl<'a> LoweringContext<'a> {
47764754 // return Try::from_error(From::from(err)),
47774755 // }
47784756
4779- let unstable_span = self . mark_span_with_reason (
4757+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
47804758 CompilerDesugaringKind :: QuestionMark ,
47814759 e. span ,
47824760 Some ( vec ! [
47834761 Symbol :: intern( "try_trait" )
47844762 ] . into ( ) ) ,
47854763 ) ;
47864764 let try_span = self . sess . source_map ( ) . end_point ( e. span ) ;
4787- let try_span = self . mark_span_with_reason (
4765+ let try_span = self . sess . source_map ( ) . mark_span_with_reason (
47884766 CompilerDesugaringKind :: QuestionMark ,
47894767 try_span,
47904768 Some ( vec ! [
@@ -5569,12 +5547,12 @@ impl<'a> LoweringContext<'a> {
55695547 ) ;
55705548 self . sess . abort_if_errors ( ) ;
55715549 }
5572- let span = self . mark_span_with_reason (
5550+ let span = self . sess . source_map ( ) . mark_span_with_reason (
55735551 CompilerDesugaringKind :: Await ,
55745552 await_span,
55755553 None ,
55765554 ) ;
5577- let gen_future_span = self . mark_span_with_reason (
5555+ let gen_future_span = self . sess . source_map ( ) . mark_span_with_reason (
55785556 CompilerDesugaringKind :: Await ,
55795557 await_span,
55805558 Some ( vec ! [ Symbol :: intern( "gen_future" ) ] . into ( ) ) ,
0 commit comments