split attributes
This commit is contained in:
parent
eedc229049
commit
1341366af9
29 changed files with 1521 additions and 1415 deletions
|
@ -809,7 +809,7 @@ impl SyntaxExtension {
|
|||
/// | yes | yes | yes | yes | yes |
|
||||
fn get_collapse_debuginfo(sess: &Session, attrs: &[impl AttributeExt], ext: bool) -> bool {
|
||||
let flag = sess.opts.cg.collapse_macro_debuginfo;
|
||||
let attr = attr::find_by_name(attrs, sym::collapse_debuginfo)
|
||||
let attr = ast::attr::find_by_name(attrs, sym::collapse_debuginfo)
|
||||
.and_then(|attr| {
|
||||
Self::collapse_debuginfo_by_name(attr)
|
||||
.map_err(|span| {
|
||||
|
@ -818,7 +818,7 @@ impl SyntaxExtension {
|
|||
.ok()
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
if attr::contains_name(attrs, sym::rustc_builtin_macro) {
|
||||
if ast::attr::contains_name(attrs, sym::rustc_builtin_macro) {
|
||||
CollapseMacroDebuginfo::Yes
|
||||
} else {
|
||||
CollapseMacroDebuginfo::Unspecified
|
||||
|
@ -850,14 +850,14 @@ impl SyntaxExtension {
|
|||
let allow_internal_unstable =
|
||||
rustc_attr::allow_internal_unstable(sess, attrs).collect::<Vec<Symbol>>();
|
||||
|
||||
let allow_internal_unsafe = attr::contains_name(attrs, sym::allow_internal_unsafe);
|
||||
let local_inner_macros = attr::find_by_name(attrs, sym::macro_export)
|
||||
let allow_internal_unsafe = ast::attr::contains_name(attrs, sym::allow_internal_unsafe);
|
||||
let local_inner_macros = ast::attr::find_by_name(attrs, sym::macro_export)
|
||||
.and_then(|macro_export| macro_export.meta_item_list())
|
||||
.is_some_and(|l| attr::list_contains_name(&l, sym::local_inner_macros));
|
||||
.is_some_and(|l| ast::attr::list_contains_name(&l, sym::local_inner_macros));
|
||||
let collapse_debuginfo = Self::get_collapse_debuginfo(sess, attrs, !is_local);
|
||||
tracing::debug!(?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe);
|
||||
|
||||
let (builtin_name, helper_attrs) = attr::find_by_name(attrs, sym::rustc_builtin_macro)
|
||||
let (builtin_name, helper_attrs) = ast::attr::find_by_name(attrs, sym::rustc_builtin_macro)
|
||||
.map(|attr| {
|
||||
// Override `helper_attrs` passed above if it's a built-in macro,
|
||||
// marking `proc_macro_derive` macros as built-in is not a realistic use case.
|
||||
|
|
|
@ -362,7 +362,7 @@ impl<'a> StripUnconfigured<'a> {
|
|||
));
|
||||
|
||||
let tokens = Some(LazyAttrTokenStream::new(AttrTokenStream::new(trees)));
|
||||
let attr = attr::mk_attr_from_item(
|
||||
let attr = ast::attr::mk_attr_from_item(
|
||||
&self.sess.psess.attr_id_generator,
|
||||
item,
|
||||
tokens,
|
||||
|
|
|
@ -3,13 +3,14 @@ use std::collections::hash_map::Entry;
|
|||
use std::{mem, slice};
|
||||
|
||||
use ast::token::IdentIsRaw;
|
||||
use rustc_ast::attr::AttributeExt;
|
||||
use rustc_ast::token::NtPatKind::*;
|
||||
use rustc_ast::token::TokenKind::*;
|
||||
use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::{DelimSpan, TokenStream};
|
||||
use rustc_ast::{self as ast, DUMMY_NODE_ID, NodeId};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_attr::{self as attr, AttributeExt, TransparencyError};
|
||||
use rustc_attr::{self as attr, TransparencyError};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||
use rustc_errors::{Applicability, ErrorGuaranteed};
|
||||
use rustc_feature::Features;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue