mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Rename nested_meta to meta_item_inner
This commit is contained in:
parent
6dfc4a0473
commit
fc64ff7ec2
@ -186,9 +186,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
}
|
||||
// Check unstable flavors of the `#[doc]` attribute.
|
||||
if attr.has_name(sym::doc) {
|
||||
for nested_meta in attr.meta_item_list().unwrap_or_default() {
|
||||
for meta_item_inner in attr.meta_item_list().unwrap_or_default() {
|
||||
macro_rules! gate_doc { ($($s:literal { $($name:ident => $feature:ident)* })*) => {
|
||||
$($(if nested_meta.has_name(sym::$name) {
|
||||
$($(if meta_item_inner.has_name(sym::$name) {
|
||||
let msg = concat!("`#[doc(", stringify!($name), ")]` is ", $s);
|
||||
gate!(self, $feature, attr.span, msg);
|
||||
})*)*
|
||||
|
@ -49,7 +49,7 @@ impl MultiItemModifier for Expander {
|
||||
let mut resolutions = match &meta_item.kind {
|
||||
MetaItemKind::List(list) => {
|
||||
list.iter()
|
||||
.filter_map(|nested_meta| match nested_meta {
|
||||
.filter_map(|meta_item_inner| match meta_item_inner {
|
||||
MetaItemInner::MetaItem(meta) => Some(meta),
|
||||
MetaItemInner::Lit(lit) => {
|
||||
// Reject `#[derive("Debug")]`.
|
||||
|
@ -1863,7 +1863,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
||||
.iter()
|
||||
.filter(|a| a.has_name(sym::derive))
|
||||
.flat_map(|a| a.meta_item_list().unwrap_or_default())
|
||||
.filter_map(|nested_meta| match nested_meta {
|
||||
.filter_map(|meta_item_inner| match meta_item_inner {
|
||||
MetaItemInner::MetaItem(ast::MetaItem {
|
||||
kind: MetaItemKind::Word,
|
||||
path,
|
||||
|
@ -1072,13 +1072,13 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
import_all = Some(meta.span);
|
||||
break;
|
||||
}
|
||||
MetaItemKind::List(nested_metas) => {
|
||||
for nested_meta in nested_metas {
|
||||
match nested_meta.ident() {
|
||||
Some(ident) if nested_meta.is_word() => {
|
||||
MetaItemKind::List(meta_item_inners) => {
|
||||
for meta_item_inner in meta_item_inners {
|
||||
match meta_item_inner.ident() {
|
||||
Some(ident) if meta_item_inner.is_word() => {
|
||||
single_imports.push(ident)
|
||||
}
|
||||
_ => ill_formed(nested_meta.span()),
|
||||
_ => ill_formed(meta_item_inner.span()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1198,8 +1198,10 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
|
||||
} else if attr::contains_name(&item.attrs, sym::proc_macro_attribute) {
|
||||
return Some((MacroKind::Attr, item.ident, item.span));
|
||||
} else if let Some(attr) = attr::find_by_name(&item.attrs, sym::proc_macro_derive) {
|
||||
if let Some(nested_meta) = attr.meta_item_list().and_then(|list| list.get(0).cloned()) {
|
||||
if let Some(ident) = nested_meta.ident() {
|
||||
if let Some(meta_item_inner) =
|
||||
attr.meta_item_list().and_then(|list| list.get(0).cloned())
|
||||
{
|
||||
if let Some(ident) = meta_item_inner.ident() {
|
||||
return Some((MacroKind::Derive, ident, ident.span));
|
||||
}
|
||||
}
|
||||
|
@ -129,8 +129,8 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools {
|
||||
let mut registered_tools = RegisteredTools::default();
|
||||
let (_, pre_configured_attrs) = &*tcx.crate_for_resolver(()).borrow();
|
||||
for attr in attr::filter_by_name(pre_configured_attrs, sym::register_tool) {
|
||||
for nested_meta in attr.meta_item_list().unwrap_or_default() {
|
||||
match nested_meta.ident() {
|
||||
for meta_item_inner in attr.meta_item_list().unwrap_or_default() {
|
||||
match meta_item_inner.ident() {
|
||||
Some(ident) => {
|
||||
if let Some(old_ident) = registered_tools.replace(ident) {
|
||||
tcx.dcx().emit_err(errors::ToolWasAlreadyRegistered {
|
||||
@ -142,7 +142,7 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools {
|
||||
}
|
||||
None => {
|
||||
tcx.dcx().emit_err(errors::ToolOnlyAcceptsIdentifiers {
|
||||
span: nested_meta.span(),
|
||||
span: meta_item_inner.span(),
|
||||
tool: sym::register_tool,
|
||||
});
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ fn format_derive(
|
||||
let item_spans = attr.meta_item_list().map(|meta_item_list| {
|
||||
meta_item_list
|
||||
.into_iter()
|
||||
.map(|nested_meta_item| nested_meta_item.span())
|
||||
.map(|meta_item_inner| meta_item_inner.span())
|
||||
})?;
|
||||
|
||||
let items = itemize_list(
|
||||
@ -536,7 +536,7 @@ pub(crate) trait MetaVisitor<'ast> {
|
||||
list: &'ast [ast::MetaItemInner],
|
||||
) {
|
||||
for nm in list {
|
||||
self.visit_nested_meta_item(nm);
|
||||
self.visit_meta_item_inner(nm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ pub(crate) trait MetaVisitor<'ast> {
|
||||
) {
|
||||
}
|
||||
|
||||
fn visit_nested_meta_item(&mut self, nm: &'ast ast::MetaItemInner) {
|
||||
fn visit_meta_item_inner(&mut self, nm: &'ast ast::MetaItemInner) {
|
||||
match nm {
|
||||
ast::MetaItemInner::MetaItem(ref meta_item) => self.visit_meta_item(meta_item),
|
||||
ast::MetaItemInner::Lit(ref lit) => self.visit_meta_item_lit(lit),
|
||||
|
@ -138,7 +138,7 @@ impl<'a> OverflowableItem<'a> {
|
||||
OverflowableItem::Expr(expr) => is_simple_expr(expr),
|
||||
OverflowableItem::MacroArg(MacroArg::Keyword(..)) => true,
|
||||
OverflowableItem::MacroArg(MacroArg::Expr(expr)) => is_simple_expr(expr),
|
||||
OverflowableItem::MetaItemInner(nested_meta_item) => match nested_meta_item {
|
||||
OverflowableItem::MetaItemInner(meta_item_inner) => match meta_item_inner {
|
||||
ast::MetaItemInner::Lit(..) => true,
|
||||
ast::MetaItemInner::MetaItem(ref meta_item) => {
|
||||
matches!(meta_item.kind, ast::MetaItemKind::Word)
|
||||
@ -184,8 +184,7 @@ impl<'a> OverflowableItem<'a> {
|
||||
MacroArg::Item(..) => len == 1,
|
||||
MacroArg::Keyword(..) => false,
|
||||
},
|
||||
OverflowableItem::MetaItemInner(nested_meta_item) if len == 1 => match nested_meta_item
|
||||
{
|
||||
OverflowableItem::MetaItemInner(meta_item_inner) if len == 1 => match meta_item_inner {
|
||||
ast::MetaItemInner::Lit(..) => false,
|
||||
ast::MetaItemInner::MetaItem(..) => true,
|
||||
},
|
||||
|
@ -116,8 +116,8 @@ fn get_skip_names(kind: &str, attrs: &[ast::Attribute]) -> Vec<String> {
|
||||
}
|
||||
|
||||
if let Some(list) = attr.meta_item_list() {
|
||||
for nested_meta_item in list {
|
||||
if let Some(name) = nested_meta_item.ident() {
|
||||
for meta_item_inner in list {
|
||||
if let Some(name) = meta_item_inner.ident() {
|
||||
skip_names.push(name.to_string());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user