|
1 | | -use crate::cfg_eval::CfgEval; |
| 1 | +use crate::cfg_eval::cfg_eval; |
2 | 2 |
|
3 | | -use rustc_ast::{self as ast, token, AstLike, ItemKind, MetaItemKind, NestedMetaItem, StmtKind}; |
| 3 | +use rustc_ast::{self as ast, token, ItemKind, MetaItemKind, NestedMetaItem, StmtKind}; |
4 | 4 | use rustc_errors::{struct_span_err, Applicability}; |
5 | 5 | use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier}; |
6 | | -use rustc_expand::config::StripUnconfigured; |
7 | 6 | use rustc_feature::AttributeTemplate; |
8 | 7 | use rustc_parse::validate_attr; |
9 | 8 | use rustc_session::Session; |
@@ -53,21 +52,7 @@ impl MultiItemModifier for Expander { |
53 | 52 |
|
54 | 53 | // FIXME: Try to cache intermediate results to avoid collecting same paths multiple times. |
55 | 54 | match ecx.resolver.resolve_derives(ecx.current_expansion.id, derives, ecx.force_mode) { |
56 | | - Ok(()) => { |
57 | | - let mut visitor = CfgEval { |
58 | | - cfg: StripUnconfigured { sess, features: ecx.ecfg.features, modified: false }, |
59 | | - }; |
60 | | - let mut item = visitor.fully_configure(item); |
61 | | - if visitor.cfg.modified { |
62 | | - // Erase the tokens if cfg-stripping modified the item |
63 | | - // This will cause us to synthesize fake tokens |
64 | | - // when `nt_to_tokenstream` is called on this item. |
65 | | - if let Some(tokens) = item.tokens_mut() { |
66 | | - *tokens = None; |
67 | | - } |
68 | | - } |
69 | | - ExpandResult::Ready(vec![item]) |
70 | | - } |
| 55 | + Ok(()) => ExpandResult::Ready(cfg_eval(ecx, item)), |
71 | 56 | Err(Indeterminate) => ExpandResult::Retry(item), |
72 | 57 | } |
73 | 58 | } |
|
0 commit comments