mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
add field attr_id to attr parser's AcceptContext
This commit is contained in:
committed by
Jonathan Brouwer
parent
4ab05bc659
commit
58168028f9
@@ -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",
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -212,6 +212,7 @@ pub fn parse_single_args<T, I>(
|
||||
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<T, I>(
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user