Replace a few Attribute constructors with mk_attr
This commit is contained in:
parent
f78bf50dec
commit
c9bd4a05bf
3 changed files with 6 additions and 26 deletions
|
@ -6396,15 +6396,8 @@ impl<'a> Parser<'a> {
|
|||
self.eval_src_mod(path, directory_ownership, id.to_string(), id_span)?;
|
||||
// Record that we fetched the mod from an external file
|
||||
if warn {
|
||||
let attr = Attribute {
|
||||
id: attr::mk_attr_id(),
|
||||
style: ast::AttrStyle::Outer,
|
||||
path: ast::Path::from_ident(
|
||||
Ident::with_empty_ctxt(sym::warn_directory_ownership)),
|
||||
tokens: TokenStream::empty(),
|
||||
is_sugared_doc: false,
|
||||
span: DUMMY_SP,
|
||||
};
|
||||
let attr = attr::mk_attr_outer(
|
||||
attr::mk_word_item(Ident::with_empty_ctxt(sym::warn_directory_ownership)));
|
||||
attr::mark_known(&attr);
|
||||
attrs.push(attr);
|
||||
}
|
||||
|
|
|
@ -16,14 +16,8 @@ use syntax_pos::hygiene::{ExpnId, ExpnInfo, ExpnKind, MacroKind};
|
|||
use std::mem;
|
||||
|
||||
fn plugin_macro_def(name: Name, span: Span) -> P<Item> {
|
||||
let rustc_builtin_macro = Attribute {
|
||||
id: attr::mk_attr_id(),
|
||||
style: AttrStyle::Outer,
|
||||
path: Path::from_ident(Ident::new(sym::rustc_builtin_macro, span)),
|
||||
tokens: TokenStream::empty(),
|
||||
is_sugared_doc: false,
|
||||
span,
|
||||
};
|
||||
let rustc_builtin_macro = attr::mk_attr_outer(
|
||||
attr::mk_word_item(Ident::new(sym::rustc_builtin_macro, span)));
|
||||
|
||||
let parens: TreeAndJoint = TokenTree::Delimited(
|
||||
DelimSpan::from_single(span), token::Paren, TokenStream::empty()
|
||||
|
|
|
@ -4,7 +4,6 @@ use syntax::ext::hygiene::{ExpnId, MacroKind};
|
|||
use syntax::ptr::P;
|
||||
use syntax::source_map::{ExpnInfo, ExpnKind, dummy_spanned, respan};
|
||||
use syntax::symbol::{Ident, Symbol, kw, sym};
|
||||
use syntax::tokenstream::TokenStream;
|
||||
use syntax_pos::DUMMY_SP;
|
||||
|
||||
use std::iter;
|
||||
|
@ -62,14 +61,8 @@ pub fn inject(
|
|||
));
|
||||
|
||||
krate.module.items.insert(0, P(ast::Item {
|
||||
attrs: vec![ast::Attribute {
|
||||
style: ast::AttrStyle::Outer,
|
||||
path: ast::Path::from_ident(ast::Ident::new(sym::prelude_import, span)),
|
||||
tokens: TokenStream::empty(),
|
||||
id: attr::mk_attr_id(),
|
||||
is_sugared_doc: false,
|
||||
span,
|
||||
}],
|
||||
attrs: vec![attr::mk_attr_outer(
|
||||
attr::mk_word_item(ast::Ident::new(sym::prelude_import, span)))],
|
||||
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
|
||||
node: ast::ItemKind::Use(P(ast::UseTree {
|
||||
prefix: ast::Path {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue