@@ -50,7 +50,6 @@ use errors::Applicability;
50
50
use rustc_data_structures:: fx:: FxHashSet ;
51
51
use rustc_data_structures:: indexed_vec:: IndexVec ;
52
52
use rustc_data_structures:: thin_vec:: ThinVec ;
53
- use rustc_data_structures:: sync:: Lrc ;
54
53
55
54
use std:: collections:: { BTreeSet , BTreeMap } ;
56
55
use std:: mem;
@@ -59,10 +58,10 @@ use syntax::attr;
59
58
use syntax:: ast;
60
59
use syntax:: ast:: * ;
61
60
use syntax:: errors;
62
- use syntax:: ext:: hygiene:: { Mark , SyntaxContext } ;
61
+ use syntax:: ext:: hygiene:: Mark ;
63
62
use syntax:: print:: pprust;
64
63
use syntax:: ptr:: P ;
65
- use syntax:: source_map:: { self , respan, CompilerDesugaringKind , Spanned } ;
64
+ use syntax:: source_map:: { respan, CompilerDesugaringKind , Spanned } ;
66
65
use syntax:: std_inject;
67
66
use syntax:: symbol:: { keywords, Symbol } ;
68
67
use syntax:: tokenstream:: { TokenStream , TokenTree } ;
@@ -854,27 +853,6 @@ impl<'a> LoweringContext<'a> {
854
853
Ident :: with_empty_ctxt ( Symbol :: gensym ( s) )
855
854
}
856
855
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
-
878
856
fn with_anonymous_lifetime_mode < R > (
879
857
& mut self ,
880
858
anonymous_lifetime_mode : AnonymousLifetimeMode ,
@@ -1162,7 +1140,7 @@ impl<'a> LoweringContext<'a> {
1162
1140
attrs : ThinVec :: new ( ) ,
1163
1141
} ;
1164
1142
1165
- let unstable_span = self . mark_span_with_reason (
1143
+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
1166
1144
CompilerDesugaringKind :: Async ,
1167
1145
span,
1168
1146
Some ( vec ! [
@@ -1569,7 +1547,7 @@ impl<'a> LoweringContext<'a> {
1569
1547
// desugaring that explicitly states that we don't want to track that.
1570
1548
// Not tracking it makes lints in rustc and clippy very fragile as
1571
1549
// 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 (
1573
1551
CompilerDesugaringKind :: ExistentialReturnType ,
1574
1552
span,
1575
1553
None ,
@@ -2443,7 +2421,7 @@ impl<'a> LoweringContext<'a> {
2443
2421
) -> hir:: FunctionRetTy {
2444
2422
let span = output. span ( ) ;
2445
2423
2446
- let exist_ty_span = self . mark_span_with_reason (
2424
+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
2447
2425
CompilerDesugaringKind :: Async ,
2448
2426
span,
2449
2427
None ,
@@ -4179,7 +4157,7 @@ impl<'a> LoweringContext<'a> {
4179
4157
} ) ,
4180
4158
ExprKind :: TryBlock ( ref body) => {
4181
4159
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 (
4183
4161
CompilerDesugaringKind :: TryBlock ,
4184
4162
body. span ,
4185
4163
Some ( vec ! [
@@ -4612,7 +4590,7 @@ impl<'a> LoweringContext<'a> {
4612
4590
// expand <head>
4613
4591
let mut head = self . lower_expr ( head) ;
4614
4592
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 (
4616
4594
CompilerDesugaringKind :: ForLoop ,
4617
4595
head_sp,
4618
4596
None ,
@@ -4773,15 +4751,15 @@ impl<'a> LoweringContext<'a> {
4773
4751
// return Try::from_error(From::from(err)),
4774
4752
// }
4775
4753
4776
- let unstable_span = self . mark_span_with_reason (
4754
+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
4777
4755
CompilerDesugaringKind :: QuestionMark ,
4778
4756
e. span ,
4779
4757
Some ( vec ! [
4780
4758
Symbol :: intern( "try_trait" )
4781
4759
] . into ( ) ) ,
4782
4760
) ;
4783
4761
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 (
4785
4763
CompilerDesugaringKind :: QuestionMark ,
4786
4764
try_span,
4787
4765
Some ( vec ! [
@@ -5566,12 +5544,12 @@ impl<'a> LoweringContext<'a> {
5566
5544
) ;
5567
5545
self . sess . abort_if_errors ( ) ;
5568
5546
}
5569
- let span = self . mark_span_with_reason (
5547
+ let span = self . sess . source_map ( ) . mark_span_with_reason (
5570
5548
CompilerDesugaringKind :: Await ,
5571
5549
await_span,
5572
5550
None ,
5573
5551
) ;
5574
- let gen_future_span = self . mark_span_with_reason (
5552
+ let gen_future_span = self . sess . source_map ( ) . mark_span_with_reason (
5575
5553
CompilerDesugaringKind :: Await ,
5576
5554
await_span,
5577
5555
Some ( vec ! [ Symbol :: intern( "gen_future" ) ] . into ( ) ) ,
0 commit comments