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