@@ -173,19 +173,12 @@ impl Invocation {
173
173
174
174
pub struct MacroExpander < ' a , ' b : ' a > {
175
175
pub cx : & ' a mut ExtCtxt < ' b > ,
176
- pub single_step : bool ,
177
- pub keep_macs : bool ,
178
176
monotonic : bool , // c.f. `cx.monotonic_expander()`
179
177
}
180
178
181
179
impl < ' a , ' b > MacroExpander < ' a , ' b > {
182
180
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 }
189
182
}
190
183
191
184
fn expand_crate ( & mut self , mut krate : ast:: Crate ) -> ast:: Crate {
@@ -238,7 +231,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
238
231
expansions. push ( Vec :: new ( ) ) ;
239
232
}
240
233
expansions[ depth] . push ( ( mark. as_u32 ( ) , expansion) ) ;
241
- if !self . single_step {
234
+ if !self . cx . ecfg . single_step {
242
235
invocations. extend ( new_invocations. into_iter ( ) . rev ( ) ) ;
243
236
}
244
237
}
@@ -417,7 +410,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
417
410
self . cx . insert_macro ( def. clone ( ) ) ;
418
411
419
412
// If keep_macs is true, expands to a MacEager::items instead.
420
- if self . keep_macs {
413
+ if self . cx . ecfg . keep_macs {
421
414
Some ( placeholders:: reconstructed_macro_rules ( & def, & path) )
422
415
} else {
423
416
Some ( placeholders:: macro_scope_placeholder ( ) )
@@ -726,6 +719,8 @@ pub struct ExpansionConfig<'feat> {
726
719
pub recursion_limit : usize ,
727
720
pub trace_mac : bool ,
728
721
pub should_test : bool , // If false, strip `#[test]` nodes
722
+ pub single_step : bool ,
723
+ pub keep_macs : bool ,
729
724
}
730
725
731
726
macro_rules! feature_tests {
@@ -749,6 +744,8 @@ impl<'feat> ExpansionConfig<'feat> {
749
744
recursion_limit : 64 ,
750
745
trace_mac : false ,
751
746
should_test : false ,
747
+ single_step : false ,
748
+ keep_macs : false ,
752
749
}
753
750
}
754
751
0 commit comments