X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_builtin_macros%2Fsrc%2Fcfg_eval.rs;h=4278fedfee9927cd282cb1b2245490e220ac7ce8;hb=0ee37d5836608381ca34c889bc1be8aeb2d40cdf;hp=7637bf7edc825cbd571d29d5b2056155eef2a6cc;hpb=e27d9df4319bd822e64f620676543d31e9c7ae2c;p=rust.git diff --git a/compiler/rustc_builtin_macros/src/cfg_eval.rs b/compiler/rustc_builtin_macros/src/cfg_eval.rs index 7637bf7edc8..4278fedfee9 100644 --- a/compiler/rustc_builtin_macros/src/cfg_eval.rs +++ b/compiler/rustc_builtin_macros/src/cfg_eval.rs @@ -7,7 +7,7 @@ use rustc_ast::visit::Visitor; use rustc_ast::NodeId; use rustc_ast::{mut_visit, visit}; -use rustc_ast::{AstLike, Attribute}; +use rustc_ast::{Attribute, HasAttrs, HasTokens}; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_expand::config::StripUnconfigured; use rustc_expand::configure; @@ -125,7 +125,7 @@ fn visit_attribute(&mut self, attr: &'ast Attribute) { } impl CfgEval<'_, '_> { - fn configure(&mut self, node: T) -> Option { + fn configure(&mut self, node: T) -> Option { self.cfg.configure(node) } @@ -173,13 +173,8 @@ fn configure_annotatable(&mut self, mut annotatable: Annotatable) -> Option unreachable!(), }; - let nt = annotatable.into_nonterminal(); - let mut orig_tokens = rustc_parse::nt_to_tokenstream( - &nt, - &self.cfg.sess.parse_sess, - CanSynthesizeMissingTokens::No, - ); + let mut orig_tokens = annotatable.to_tokens(&self.cfg.sess.parse_sess); // 'Flatten' all nonterminals (i.e. `TokenKind::Interpolated`) // to `None`-delimited groups containing the corresponding tokens. This