about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/macros.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-15 08:38:13 +0000
committerbors <bors@rust-lang.org>2025-07-15 08:38:13 +0000
commita9fb6103b05c6ad6eee6bed4c0bb5a2e8e1024c6 (patch)
tree635bf7b454df9fe8fbb5d76d8f75102f59e33b6b /compiler/rustc_resolve/src/macros.rs
parent7f2065a4bae1faed5bab928c670964eafbf43b55 (diff)
parent7a7c74ad89df9f87824fa17fbbe0448d9ab6f7cc (diff)
downloadrust-a9fb6103b05c6ad6eee6bed4c0bb5a2e8e1024c6.tar.gz
rust-a9fb6103b05c6ad6eee6bed4c0bb5a2e8e1024c6.zip
Auto merge of #143460 - JonathanBrouwer:cfg_parser, r=jdonszelmann
Port `#[cfg]` to the new attribute parsing infrastructure

Ports `#[cfg]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

I've split this PR into commits for reviewability, and left some comments to clarify things
Diffstat (limited to 'compiler/rustc_resolve/src/macros.rs')
-rw-r--r--compiler/rustc_resolve/src/macros.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs
index 5864b035f73..cbb24289f51 100644
--- a/compiler/rustc_resolve/src/macros.rs
+++ b/compiler/rustc_resolve/src/macros.rs
@@ -5,10 +5,9 @@ use std::cell::Cell;
 use std::mem;
 use std::sync::Arc;
 
-use rustc_ast::expand::StrippedCfgItem;
 use rustc_ast::{self as ast, Crate, NodeId, attr};
 use rustc_ast_pretty::pprust;
-use rustc_attr_data_structures::StabilityLevel;
+use rustc_attr_data_structures::{CfgEntry, StabilityLevel, StrippedCfgItem};
 use rustc_errors::{Applicability, DiagCtxtHandle, StashKey};
 use rustc_expand::base::{
     Annotatable, DeriveResolution, Indeterminate, ResolverExpand, SyntaxExtension,
@@ -485,8 +484,18 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
         self.proc_macros.push(self.local_def_id(id))
     }
 
-    fn append_stripped_cfg_item(&mut self, parent_node: NodeId, ident: Ident, cfg: ast::MetaItem) {
-        self.stripped_cfg_items.push(StrippedCfgItem { parent_module: parent_node, ident, cfg });
+    fn append_stripped_cfg_item(
+        &mut self,
+        parent_node: NodeId,
+        ident: Ident,
+        cfg: CfgEntry,
+        cfg_span: Span,
+    ) {
+        self.stripped_cfg_items.push(StrippedCfgItem {
+            parent_module: parent_node,
+            ident,
+            cfg: (cfg, cfg_span),
+        });
     }
 
     fn registered_tools(&self) -> &RegisteredTools {