@@ -16,7 +16,7 @@ use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS};
1616use rustc_session:: { parse:: ParseSess , Limit , Session } ;
1717use rustc_span:: def_id:: { CrateNum , DefId } ;
1818use rustc_span:: edition:: Edition ;
19- use rustc_span:: hygiene:: { AstPass , ExpnData , ExpnId , ExpnKind } ;
19+ use rustc_span:: hygiene:: { AstPass , ExpnData , ExpnKind , LocalExpnId } ;
2020use rustc_span:: source_map:: SourceMap ;
2121use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
2222use rustc_span:: { FileName , MultiSpan , Span , DUMMY_SP } ;
@@ -813,15 +813,15 @@ impl SyntaxExtension {
813813
814814 pub fn expn_data (
815815 & self ,
816- parent : ExpnId ,
816+ parent : LocalExpnId ,
817817 call_site : Span ,
818818 descr : Symbol ,
819819 macro_def_id : Option < DefId > ,
820820 parent_module : Option < DefId > ,
821821 ) -> ExpnData {
822822 ExpnData :: new (
823823 ExpnKind :: Macro ( self . macro_kind ( ) , descr) ,
824- parent,
824+ parent. to_expn_id ( ) ,
825825 call_site,
826826 self . span ,
827827 self . allow_internal_unstable . clone ( ) ,
@@ -843,7 +843,11 @@ pub trait ResolverExpand {
843843 fn next_node_id ( & mut self ) -> NodeId ;
844844
845845 fn resolve_dollar_crates ( & mut self ) ;
846- fn visit_ast_fragment_with_placeholders ( & mut self , expn_id : ExpnId , fragment : & AstFragment ) ;
846+ fn visit_ast_fragment_with_placeholders (
847+ & mut self ,
848+ expn_id : LocalExpnId ,
849+ fragment : & AstFragment ,
850+ ) ;
847851 fn register_builtin_macro ( & mut self , name : Symbol , ext : SyntaxExtensionKind ) ;
848852
849853 fn expansion_for_ast_pass (
@@ -852,37 +856,41 @@ pub trait ResolverExpand {
852856 pass : AstPass ,
853857 features : & [ Symbol ] ,
854858 parent_module_id : Option < NodeId > ,
855- ) -> ExpnId ;
859+ ) -> LocalExpnId ;
856860
857861 fn resolve_imports ( & mut self ) ;
858862
859863 fn resolve_macro_invocation (
860864 & mut self ,
861865 invoc : & Invocation ,
862- eager_expansion_root : ExpnId ,
866+ eager_expansion_root : LocalExpnId ,
863867 force : bool ,
864868 ) -> Result < Lrc < SyntaxExtension > , Indeterminate > ;
865869
866870 fn check_unused_macros ( & mut self ) ;
867871
868872 /// Some parent node that is close enough to the given macro call.
869- fn lint_node_id ( & self , expn_id : ExpnId ) -> NodeId ;
873+ fn lint_node_id ( & self , expn_id : LocalExpnId ) -> NodeId ;
870874
871875 // Resolver interfaces for specific built-in macros.
872876 /// Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Copy` inside it?
873- fn has_derive_copy ( & self , expn_id : ExpnId ) -> bool ;
877+ fn has_derive_copy ( & self , expn_id : LocalExpnId ) -> bool ;
874878 /// Resolve paths inside the `#[derive(...)]` attribute with the given `ExpnId`.
875879 fn resolve_derives (
876880 & mut self ,
877- expn_id : ExpnId ,
881+ expn_id : LocalExpnId ,
878882 force : bool ,
879883 derive_paths : & dyn Fn ( ) -> DeriveResolutions ,
880884 ) -> Result < ( ) , Indeterminate > ;
881885 /// Take resolutions for paths inside the `#[derive(...)]` attribute with the given `ExpnId`
882886 /// back from resolver.
883- fn take_derive_resolutions ( & mut self , expn_id : ExpnId ) -> Option < DeriveResolutions > ;
887+ fn take_derive_resolutions ( & mut self , expn_id : LocalExpnId ) -> Option < DeriveResolutions > ;
884888 /// Path resolution logic for `#[cfg_accessible(path)]`.
885- fn cfg_accessible ( & mut self , expn_id : ExpnId , path : & ast:: Path ) -> Result < bool , Indeterminate > ;
889+ fn cfg_accessible (
890+ & mut self ,
891+ expn_id : LocalExpnId ,
892+ path : & ast:: Path ,
893+ ) -> Result < bool , Indeterminate > ;
886894
887895 /// Decodes the proc-macro quoted span in the specified crate, with the specified id.
888896 /// No caching is performed.
@@ -913,7 +921,7 @@ impl ModuleData {
913921
914922#[ derive( Clone ) ]
915923pub struct ExpansionData {
916- pub id : ExpnId ,
924+ pub id : LocalExpnId ,
917925 pub depth : usize ,
918926 pub module : Rc < ModuleData > ,
919927 pub dir_ownership : DirOwnership ,
@@ -958,7 +966,7 @@ impl<'a> ExtCtxt<'a> {
958966 extern_mod_loaded,
959967 root_path : PathBuf :: new ( ) ,
960968 current_expansion : ExpansionData {
961- id : ExpnId :: root ( ) ,
969+ id : LocalExpnId :: ROOT ,
962970 depth : 0 ,
963971 module : Default :: default ( ) ,
964972 dir_ownership : DirOwnership :: Owned { relative : None } ,
@@ -995,19 +1003,19 @@ impl<'a> ExtCtxt<'a> {
9951003 /// Equivalent of `Span::def_site` from the proc macro API,
9961004 /// except that the location is taken from the span passed as an argument.
9971005 pub fn with_def_site_ctxt ( & self , span : Span ) -> Span {
998- span. with_def_site_ctxt ( self . current_expansion . id )
1006+ span. with_def_site_ctxt ( self . current_expansion . id . to_expn_id ( ) )
9991007 }
10001008
10011009 /// Equivalent of `Span::call_site` from the proc macro API,
10021010 /// except that the location is taken from the span passed as an argument.
10031011 pub fn with_call_site_ctxt ( & self , span : Span ) -> Span {
1004- span. with_call_site_ctxt ( self . current_expansion . id )
1012+ span. with_call_site_ctxt ( self . current_expansion . id . to_expn_id ( ) )
10051013 }
10061014
10071015 /// Equivalent of `Span::mixed_site` from the proc macro API,
10081016 /// except that the location is taken from the span passed as an argument.
10091017 pub fn with_mixed_site_ctxt ( & self , span : Span ) -> Span {
1010- span. with_mixed_site_ctxt ( self . current_expansion . id )
1018+ span. with_mixed_site_ctxt ( self . current_expansion . id . to_expn_id ( ) )
10111019 }
10121020
10131021 /// Returns span for the macro which originally caused the current expansion to happen.
0 commit comments