@@ -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 } ;
@@ -855,27 +854,6 @@ impl<'a> LoweringContext<'a> {
855
854
Ident :: with_empty_ctxt ( Symbol :: gensym ( s) )
856
855
}
857
856
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
-
879
857
fn with_anonymous_lifetime_mode < R > (
880
858
& mut self ,
881
859
anonymous_lifetime_mode : AnonymousLifetimeMode ,
@@ -1164,7 +1142,7 @@ impl<'a> LoweringContext<'a> {
1164
1142
attrs : ThinVec :: new ( ) ,
1165
1143
} ;
1166
1144
1167
- let unstable_span = self . mark_span_with_reason (
1145
+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
1168
1146
CompilerDesugaringKind :: Async ,
1169
1147
span,
1170
1148
Some ( vec ! [
@@ -1571,7 +1549,7 @@ impl<'a> LoweringContext<'a> {
1571
1549
// desugaring that explicitly states that we don't want to track that.
1572
1550
// Not tracking it makes lints in rustc and clippy very fragile as
1573
1551
// 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 (
1575
1553
CompilerDesugaringKind :: ExistentialReturnType ,
1576
1554
span,
1577
1555
None ,
@@ -2446,7 +2424,7 @@ impl<'a> LoweringContext<'a> {
2446
2424
) -> hir:: FunctionRetTy {
2447
2425
let span = output. span ( ) ;
2448
2426
2449
- let exist_ty_span = self . mark_span_with_reason (
2427
+ let exist_ty_span = self . sess . source_map ( ) . mark_span_with_reason (
2450
2428
CompilerDesugaringKind :: Async ,
2451
2429
span,
2452
2430
None ,
@@ -4182,7 +4160,7 @@ impl<'a> LoweringContext<'a> {
4182
4160
} ) ,
4183
4161
ExprKind :: TryBlock ( ref body) => {
4184
4162
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 (
4186
4164
CompilerDesugaringKind :: TryBlock ,
4187
4165
body. span ,
4188
4166
Some ( vec ! [
@@ -4615,7 +4593,7 @@ impl<'a> LoweringContext<'a> {
4615
4593
// expand <head>
4616
4594
let mut head = self . lower_expr ( head) ;
4617
4595
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 (
4619
4597
CompilerDesugaringKind :: ForLoop ,
4620
4598
head_sp,
4621
4599
None ,
@@ -4776,15 +4754,15 @@ impl<'a> LoweringContext<'a> {
4776
4754
// return Try::from_error(From::from(err)),
4777
4755
// }
4778
4756
4779
- let unstable_span = self . mark_span_with_reason (
4757
+ let unstable_span = self . sess . source_map ( ) . mark_span_with_reason (
4780
4758
CompilerDesugaringKind :: QuestionMark ,
4781
4759
e. span ,
4782
4760
Some ( vec ! [
4783
4761
Symbol :: intern( "try_trait" )
4784
4762
] . into ( ) ) ,
4785
4763
) ;
4786
4764
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 (
4788
4766
CompilerDesugaringKind :: QuestionMark ,
4789
4767
try_span,
4790
4768
Some ( vec ! [
@@ -5569,12 +5547,12 @@ impl<'a> LoweringContext<'a> {
5569
5547
) ;
5570
5548
self . sess . abort_if_errors ( ) ;
5571
5549
}
5572
- let span = self . mark_span_with_reason (
5550
+ let span = self . sess . source_map ( ) . mark_span_with_reason (
5573
5551
CompilerDesugaringKind :: Await ,
5574
5552
await_span,
5575
5553
None ,
5576
5554
) ;
5577
- let gen_future_span = self . mark_span_with_reason (
5555
+ let gen_future_span = self . sess . source_map ( ) . mark_span_with_reason (
5578
5556
CompilerDesugaringKind :: Await ,
5579
5557
await_span,
5580
5558
Some ( vec ! [ Symbol :: intern( "gen_future" ) ] . into ( ) ) ,
0 commit comments