Drop span argument from mk_list_item
This commit is contained in:
parent
4be0675589
commit
ab3fb1e775
6 changed files with 11 additions and 14 deletions
|
@ -5176,11 +5176,10 @@ impl<'a> LoweringContext<'a> {
|
||||||
let attr = {
|
let attr = {
|
||||||
// `allow(unreachable_code)`
|
// `allow(unreachable_code)`
|
||||||
let allow = {
|
let allow = {
|
||||||
let allow_ident = Ident::with_empty_ctxt(sym::allow).with_span_pos(e.span);
|
let allow_ident = Ident::new(sym::allow, e.span);
|
||||||
let uc_ident = Ident::with_empty_ctxt(sym::unreachable_code)
|
let uc_ident = Ident::new(sym::unreachable_code, e.span);
|
||||||
.with_span_pos(e.span);
|
|
||||||
let uc_nested = attr::mk_nested_word_item(uc_ident);
|
let uc_nested = attr::mk_nested_word_item(uc_ident);
|
||||||
attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
|
attr::mk_list_item(allow_ident, vec![uc_nested])
|
||||||
};
|
};
|
||||||
attr::mk_attr_outer(allow)
|
attr::mk_attr_outer(allow)
|
||||||
};
|
};
|
||||||
|
|
|
@ -355,8 +355,8 @@ pub fn mk_name_value_item(span: Span, ident: Ident, lit_kind: LitKind, lit_span:
|
||||||
MetaItem { path: Path::from_ident(ident), span, node: MetaItemKind::NameValue(lit) }
|
MetaItem { path: Path::from_ident(ident), span, node: MetaItemKind::NameValue(lit) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_list_item(span: Span, ident: Ident, items: Vec<NestedMetaItem>) -> MetaItem {
|
pub fn mk_list_item(ident: Ident, items: Vec<NestedMetaItem>) -> MetaItem {
|
||||||
MetaItem { path: Path::from_ident(ident), span, node: MetaItemKind::List(items) }
|
MetaItem { path: Path::from_ident(ident), span: ident.span, node: MetaItemKind::List(items) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mk_word_item(ident: Ident) -> MetaItem {
|
pub fn mk_word_item(ident: Ident) -> MetaItem {
|
||||||
|
|
|
@ -879,7 +879,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
|
|
||||||
pub fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec<ast::NestedMetaItem>)
|
pub fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec<ast::NestedMetaItem>)
|
||||||
-> ast::MetaItem {
|
-> ast::MetaItem {
|
||||||
attr::mk_list_item(sp, Ident::new(name, sp), mis)
|
attr::mk_list_item(Ident::new(name, sp), mis)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
|
pub fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
];
|
];
|
||||||
|
|
||||||
let include_ident = Ident::with_empty_ctxt(sym::include);
|
let include_ident = Ident::with_empty_ctxt(sym::include);
|
||||||
let item = attr::mk_list_item(DUMMY_SP, include_ident, include_info);
|
let item = attr::mk_list_item(include_ident, include_info);
|
||||||
items.push(ast::NestedMetaItem::MetaItem(item));
|
items.push(ast::NestedMetaItem::MetaItem(item));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -1333,7 +1333,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items);
|
let meta = attr::mk_list_item(Ident::with_empty_ctxt(sym::doc), items);
|
||||||
*at = attr::Attribute {
|
*at = attr::Attribute {
|
||||||
span: at.span,
|
span: at.span,
|
||||||
id: at.id,
|
id: at.id,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::tokenstream::{self, TokenStream, TokenTree};
|
||||||
|
|
||||||
use rustc_target::spec::abi::{self, Abi};
|
use rustc_target::spec::abi::{self, Abi};
|
||||||
use syntax_pos::{self, BytePos};
|
use syntax_pos::{self, BytePos};
|
||||||
use syntax_pos::{DUMMY_SP, FileName, Span};
|
use syntax_pos::{FileName, Span};
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
@ -124,8 +124,7 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
|
||||||
|
|
||||||
// #![feature(prelude_import)]
|
// #![feature(prelude_import)]
|
||||||
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
|
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
|
||||||
let list = attr::mk_list_item(
|
let list = attr::mk_list_item(ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
|
||||||
DUMMY_SP, ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
|
|
||||||
let fake_attr = attr::mk_attr_inner(list);
|
let fake_attr = attr::mk_attr_inner(list);
|
||||||
s.print_attribute(&fake_attr);
|
s.print_attribute(&fake_attr);
|
||||||
|
|
||||||
|
|
|
@ -157,8 +157,7 @@ impl MutVisitor for EntryPointCleaner {
|
||||||
item.map(|ast::Item {id, ident, attrs, node, vis, span, tokens}| {
|
item.map(|ast::Item {id, ident, attrs, node, vis, span, tokens}| {
|
||||||
let allow_ident = Ident::with_empty_ctxt(sym::allow);
|
let allow_ident = Ident::with_empty_ctxt(sym::allow);
|
||||||
let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
|
let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
|
||||||
let allow_dead_code_item = attr::mk_list_item(DUMMY_SP, allow_ident,
|
let allow_dead_code_item = attr::mk_list_item(allow_ident, vec![dc_nested]);
|
||||||
vec![dc_nested]);
|
|
||||||
let allow_dead_code = attr::mk_attr_outer(allow_dead_code_item);
|
let allow_dead_code = attr::mk_attr_outer(allow_dead_code_item);
|
||||||
|
|
||||||
ast::Item {
|
ast::Item {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue