11
11
use ast:: { self , Block , Ident , NodeId , PatKind , Path } ;
12
12
use ast:: { MacStmtStyle , StmtKind , ItemKind } ;
13
13
use attr:: { self , HasAttrs } ;
14
- use codemap:: { ExpnInfo , NameAndSpan , MacroBang , MacroAttribute , dummy_spanned, respan} ;
14
+ use codemap:: { ExpnInfo , MacroBang , MacroAttribute , dummy_spanned, respan} ;
15
15
use config:: { is_test_or_bench, StripUnconfigured } ;
16
16
use errors:: { Applicability , FatalError } ;
17
17
use ext:: base:: * ;
@@ -514,7 +514,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
514
514
let suggested_limit = self . cx . ecfg . recursion_limit * 2 ;
515
515
let mut err = self . cx . struct_span_err ( info. call_site ,
516
516
& format ! ( "recursion limit reached while expanding the macro `{}`" ,
517
- info. callee . name( ) ) ) ;
517
+ info. format . name( ) ) ) ;
518
518
err. help ( & format ! (
519
519
"consider adding a `#![recursion_limit=\" {}\" ]` attribute to your crate" ,
520
520
suggested_limit) ) ;
@@ -538,13 +538,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
538
538
attr:: mark_used ( & attr) ;
539
539
invoc. expansion_data . mark . set_expn_info ( ExpnInfo {
540
540
call_site : attr. span ,
541
- callee : NameAndSpan {
542
- format : MacroAttribute ( Symbol :: intern ( & format ! ( "{}" , attr. path) ) ) ,
543
- span : None ,
544
- allow_internal_unstable : false ,
545
- allow_internal_unsafe : false ,
546
- edition : ext. edition ( ) ,
547
- }
541
+ def_site : None ,
542
+ format : MacroAttribute ( Symbol :: intern ( & format ! ( "{}" , attr. path) ) ) ,
543
+ allow_internal_unstable : false ,
544
+ allow_internal_unsafe : false ,
545
+ edition : ext. edition ( ) ,
548
546
} ) ;
549
547
550
548
match * ext {
@@ -727,13 +725,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
727
725
}
728
726
mark. set_expn_info ( ExpnInfo {
729
727
call_site : span,
730
- callee : NameAndSpan {
731
- format : macro_bang_format ( path) ,
732
- span : def_site_span,
733
- allow_internal_unstable,
734
- allow_internal_unsafe,
735
- edition,
736
- } ,
728
+ def_site : def_site_span,
729
+ format : macro_bang_format ( path) ,
730
+ allow_internal_unstable,
731
+ allow_internal_unsafe,
732
+ edition,
737
733
} ) ;
738
734
Ok ( ( ) )
739
735
} ;
@@ -777,13 +773,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
777
773
} else {
778
774
invoc. expansion_data . mark . set_expn_info ( ExpnInfo {
779
775
call_site : span,
780
- callee : NameAndSpan {
781
- format : macro_bang_format ( path) ,
782
- span : tt_span,
783
- allow_internal_unstable,
784
- allow_internal_unsafe : false ,
785
- edition : hygiene:: default_edition ( ) ,
786
- }
776
+ def_site : tt_span,
777
+ format : macro_bang_format ( path) ,
778
+ allow_internal_unstable,
779
+ allow_internal_unsafe : false ,
780
+ edition : hygiene:: default_edition ( ) ,
787
781
} ) ;
788
782
789
783
let input: Vec < _ > = mac. node . stream ( ) . into_trees ( ) . collect ( ) ;
@@ -815,16 +809,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
815
809
self . gate_proc_macro_expansion_kind ( span, kind) ;
816
810
invoc. expansion_data . mark . set_expn_info ( ExpnInfo {
817
811
call_site : span,
818
- callee : NameAndSpan {
819
- format : macro_bang_format ( path) ,
820
- // FIXME procedural macros do not have proper span info
821
- // yet, when they do, we should use it here.
822
- span : None ,
823
- // FIXME probably want to follow macro_rules macros here.
824
- allow_internal_unstable,
825
- allow_internal_unsafe : false ,
826
- edition,
827
- } ,
812
+ // FIXME procedural macros do not have proper span info
813
+ // yet, when they do, we should use it here.
814
+ def_site : None ,
815
+ format : macro_bang_format ( path) ,
816
+ // FIXME probably want to follow macro_rules macros here.
817
+ allow_internal_unstable,
818
+ allow_internal_unsafe : false ,
819
+ edition,
828
820
} ) ;
829
821
830
822
let tok_result = expandfun. expand ( self . cx , span, mac. node . stream ( ) ) ;
@@ -894,13 +886,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
894
886
895
887
let mut expn_info = ExpnInfo {
896
888
call_site : span,
897
- callee : NameAndSpan {
898
- format : MacroAttribute ( pretty_name) ,
899
- span : None ,
900
- allow_internal_unstable : false ,
901
- allow_internal_unsafe : false ,
902
- edition : ext. edition ( ) ,
903
- }
889
+ def_site : None ,
890
+ format : MacroAttribute ( pretty_name) ,
891
+ allow_internal_unstable : false ,
892
+ allow_internal_unsafe : false ,
893
+ edition : ext. edition ( ) ,
904
894
} ;
905
895
906
896
match * ext {
@@ -916,7 +906,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
916
906
Some ( invoc. fragment_kind . expect_from_annotatables ( items) )
917
907
}
918
908
BuiltinDerive ( func) => {
919
- expn_info. callee . allow_internal_unstable = true ;
909
+ expn_info. allow_internal_unstable = true ;
920
910
invoc. expansion_data . mark . set_expn_info ( expn_info) ;
921
911
let span = span. with_ctxt ( self . cx . backtrace ( ) ) ;
922
912
let mut items = Vec :: new ( ) ;
0 commit comments