@@ -173,19 +173,12 @@ impl Invocation {
173173
174174pub struct MacroExpander < ' a , ' b : ' a > {
175175 pub cx : & ' a mut ExtCtxt < ' b > ,
176- pub single_step : bool ,
177- pub keep_macs : bool ,
178176 monotonic : bool , // c.f. `cx.monotonic_expander()`
179177}
180178
181179impl < ' a , ' b > MacroExpander < ' a , ' b > {
182180 pub fn new ( cx : & ' a mut ExtCtxt < ' b > , monotonic : bool ) -> Self {
183- MacroExpander {
184- cx : cx,
185- monotonic : monotonic,
186- single_step : false ,
187- keep_macs : false ,
188- }
181+ MacroExpander { cx : cx, monotonic : monotonic }
189182 }
190183
191184 fn expand_crate ( & mut self , mut krate : ast:: Crate ) -> ast:: Crate {
@@ -238,7 +231,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
238231 expansions. push ( Vec :: new ( ) ) ;
239232 }
240233 expansions[ depth] . push ( ( mark. as_u32 ( ) , expansion) ) ;
241- if !self . single_step {
234+ if !self . cx . ecfg . single_step {
242235 invocations. extend ( new_invocations. into_iter ( ) . rev ( ) ) ;
243236 }
244237 }
@@ -417,7 +410,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
417410 self . cx . insert_macro ( def. clone ( ) ) ;
418411
419412 // If keep_macs is true, expands to a MacEager::items instead.
420- if self . keep_macs {
413+ if self . cx . ecfg . keep_macs {
421414 Some ( placeholders:: reconstructed_macro_rules ( & def, & path) )
422415 } else {
423416 Some ( placeholders:: macro_scope_placeholder ( ) )
@@ -726,6 +719,8 @@ pub struct ExpansionConfig<'feat> {
726719 pub recursion_limit : usize ,
727720 pub trace_mac : bool ,
728721 pub should_test : bool , // If false, strip `#[test]` nodes
722+ pub single_step : bool ,
723+ pub keep_macs : bool ,
729724}
730725
731726macro_rules! feature_tests {
@@ -749,6 +744,8 @@ impl<'feat> ExpansionConfig<'feat> {
749744 recursion_limit : 64 ,
750745 trace_mac : false ,
751746 should_test : false ,
747+ single_step : false ,
748+ keep_macs : false ,
752749 }
753750 }
754751
0 commit comments