@@ -646,7 +646,6 @@ impl<'a> ExtCtxt<'a> {
646
646
}
647
647
648
648
pub fn bt_push ( & mut self , ei : ExpnInfo ) {
649
- self . recursion_count += 1 ;
650
649
if self . recursion_count > self . ecfg . recursion_limit {
651
650
self . span_fatal ( ei. call_site ,
652
651
& format ! ( "recursion limit reached while expanding the macro `{}`" ,
@@ -660,17 +659,7 @@ impl<'a> ExtCtxt<'a> {
660
659
callee : ei. callee
661
660
} ) ;
662
661
}
663
- pub fn bt_pop ( & mut self ) {
664
- match self . backtrace {
665
- NO_EXPANSION => self . bug ( "tried to pop without a push" ) ,
666
- expn_id => {
667
- self . recursion_count -= 1 ;
668
- self . backtrace = self . codemap ( ) . with_expn_info ( expn_id, |expn_info| {
669
- expn_info. map_or ( NO_EXPANSION , |ei| ei. call_site . expn_id )
670
- } ) ;
671
- }
672
- }
673
- }
662
+ pub fn bt_pop ( & mut self ) { }
674
663
675
664
pub fn insert_macro ( & mut self , def : ast:: MacroDef ) {
676
665
if def. export {
@@ -799,8 +788,6 @@ impl<'a> ExtCtxt<'a> {
799
788
self . crate_root = Some ( "std" ) ;
800
789
}
801
790
802
- // User extensions must be added before expander.load_macros is called,
803
- // so that macros from external crates shadow user defined extensions.
804
791
for ( name, extension) in user_exts {
805
792
self . syntax_env . insert ( name, extension) ;
806
793
}
@@ -900,7 +887,7 @@ pub fn get_exprs_from_tts(cx: &mut ExtCtxt,
900
887
/// This environment maps Names to SyntaxExtensions.
901
888
pub struct SyntaxEnv {
902
889
module_data : Vec < ModuleData > ,
903
- current_module : Module ,
890
+ pub current_module : Module ,
904
891
905
892
/// All bang-style macro/extension names
906
893
/// encountered so far; to be used for diagnostics in resolve
@@ -940,10 +927,6 @@ impl SyntaxEnv {
940
927
& self . module_data [ module. 0 as usize ]
941
928
}
942
929
943
- pub fn set_current_module ( & mut self , module : Module ) -> Module {
944
- :: std:: mem:: replace ( & mut self . current_module , module)
945
- }
946
-
947
930
pub fn paths ( & self ) -> Rc < ModulePaths > {
948
931
self . data ( self . current_module ) . paths . clone ( )
949
932
}
@@ -994,8 +977,6 @@ impl SyntaxEnv {
994
977
}
995
978
996
979
pub fn is_crate_root ( & mut self ) -> bool {
997
- // The first frame is pushed in `SyntaxEnv::new()` and the second frame is
998
- // pushed when folding the crate root pseudo-module (c.f. noop_fold_crate).
999
- self . current_module . 0 <= 1
980
+ self . current_module == Module ( 0 )
1000
981
}
1001
982
}
0 commit comments