about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros/src
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-09-18 17:44:32 +0200
committerUrgau <urgau@numericable.fr>2024-10-01 10:01:09 +0200
commit57b9b1f9745a56943cc0aebc4c3ec487945f044e (patch)
tree54688059c287db2d7f2a33ed6205fe9b3673ab4d /compiler/rustc_builtin_macros/src
parentc3ce4e66a5732a5b89c9f495b44357bf6b29d424 (diff)
downloadrust-57b9b1f9745a56943cc0aebc4c3ec487945f044e.tar.gz
rust-57b9b1f9745a56943cc0aebc4c3ec487945f044e.zip
Use `ast::NestedMetaItem` when evaluating cfg predicate
Diffstat (limited to 'compiler/rustc_builtin_macros/src')
-rw-r--r--compiler/rustc_builtin_macros/src/cfg.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_builtin_macros/src/cfg.rs b/compiler/rustc_builtin_macros/src/cfg.rs
index cf1d5c68ead..940c94b1cfc 100644
--- a/compiler/rustc_builtin_macros/src/cfg.rs
+++ b/compiler/rustc_builtin_macros/src/cfg.rs
@@ -6,7 +6,6 @@ use rustc_ast::token;
 use rustc_ast::tokenstream::TokenStream;
 use rustc_errors::PResult;
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
-use rustc_parse::parser::attr::AllowLeadingUnsafe;
 use rustc_span::Span;
 use {rustc_ast as ast, rustc_attr as attr};
 
@@ -36,14 +35,18 @@ pub(crate) fn expand_cfg(
     })
 }
 
-fn parse_cfg<'a>(cx: &ExtCtxt<'a>, span: Span, tts: TokenStream) -> PResult<'a, ast::MetaItem> {
+fn parse_cfg<'a>(
+    cx: &ExtCtxt<'a>,
+    span: Span,
+    tts: TokenStream,
+) -> PResult<'a, ast::NestedMetaItem> {
     let mut p = cx.new_parser_from_tts(tts);
 
     if p.token == token::Eof {
         return Err(cx.dcx().create_err(errors::RequiresCfgPattern { span }));
     }
 
-    let cfg = p.parse_meta_item(AllowLeadingUnsafe::No)?;
+    let cfg = p.parse_meta_item_inner()?;
 
     let _ = p.eat(&token::Comma);