diff --git a/Cargo.lock b/Cargo.lock index 0d541973ac5e..d0e8c675b5c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4224,7 +4224,6 @@ dependencies = [ name = "rustc_lint_defs" version = "0.0.0" dependencies = [ - "rustc_ast", "rustc_data_structures", "rustc_error_messages", "rustc_hir_id", diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index ce7dc62df0ba..4340508bbdf2 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -15,7 +15,7 @@ use rustc_parse::parser::Recovery; use rustc_session::Session; use rustc_session::lint::{Lint, LintId}; -use rustc_span::{ErrorGuaranteed, Span, Symbol}; +use rustc_span::{AttrId, ErrorGuaranteed, Span, Symbol}; use crate::AttributeParser; // Glob imports to avoid big, bitrotty import lists @@ -445,6 +445,8 @@ pub struct AcceptContext<'f, 'sess, S: Stage> { /// The name of the attribute we're currently accepting. pub(crate) attr_path: AttrPath, + + pub(crate) attr_id: AttrId, } impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> { diff --git a/compiler/rustc_attr_parsing/src/interface.rs b/compiler/rustc_attr_parsing/src/interface.rs index adf8e97ef609..82cfe19147cc 100644 --- a/compiler/rustc_attr_parsing/src/interface.rs +++ b/compiler/rustc_attr_parsing/src/interface.rs @@ -212,6 +212,7 @@ pub fn parse_single_args( if let Some(safety) = attr_safety { parser.check_attribute_safety(&attr_path, inner_span, safety, &mut emit_lint) } + let attr_id = sess.psess.attr_id_generator.mk_attr_id(); let mut cx: AcceptContext<'_, 'sess, Early> = AcceptContext { shared: SharedContext { cx: &mut parser, @@ -225,6 +226,7 @@ pub fn parse_single_args( parsed_description, template, attr_path, + attr_id, }; parse_fn(&mut cx, args) } @@ -390,6 +392,7 @@ pub fn parse_attribute_list( parsed_description: ParsedDescription::Attribute, template: &accept.template, attr_path: attr_path.clone(), + attr_id: attr.id, }; (accept.accept_fn)(&mut cx, &args);