Skip to content

Commit 3573fb6

Browse files
committed
forward attributes on EII implementation functions
1 parent d9b6e0a commit 3573fb6

File tree

1 file changed

+28
-25
lines changed
  • compiler/rustc_builtin_macros/src

1 file changed

+28
-25
lines changed

compiler/rustc_builtin_macros/src/eii.rs

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn eii_(
209209
safety: ast::Safety::Unsafe(span),
210210
abi,
211211
items: From::from([P(ast::ForeignItem {
212-
attrs,
212+
attrs: attrs.clone(),
213213
id: ast::DUMMY_NODE_ID,
214214
span: item_span,
215215
vis,
@@ -220,31 +220,34 @@ fn eii_(
220220
tokens: None,
221221
}));
222222

223-
let macro_def = Annotatable::Item(P(ast::Item {
224-
attrs: ast::AttrVec::from_iter([
225-
// #[builtin_macro(eii_macro)]
226-
ast::Attribute {
227-
kind: ast::AttrKind::Normal(P(ast::NormalAttr {
228-
item: ast::AttrItem {
229-
unsafety: ast::Safety::Default,
230-
path: ast::Path::from_ident(Ident::new(sym::rustc_builtin_macro, span)),
231-
args: ast::AttrArgs::Delimited(ast::DelimArgs {
232-
dspan: DelimSpan::from_single(span),
233-
delim: Delimiter::Parenthesis,
234-
tokens: TokenStream::new(vec![tokenstream::TokenTree::token_alone(
235-
token::TokenKind::Ident(sym::eii_macro, token::IdentIsRaw::No),
236-
span,
237-
)]),
238-
}),
239-
tokens: None,
240-
},
223+
let mut macro_attrs = attrs.clone();
224+
macro_attrs.push(
225+
// #[builtin_macro(eii_macro)]
226+
ast::Attribute {
227+
kind: ast::AttrKind::Normal(P(ast::NormalAttr {
228+
item: ast::AttrItem {
229+
unsafety: ast::Safety::Default,
230+
path: ast::Path::from_ident(Ident::new(sym::rustc_builtin_macro, span)),
231+
args: ast::AttrArgs::Delimited(ast::DelimArgs {
232+
dspan: DelimSpan::from_single(span),
233+
delim: Delimiter::Parenthesis,
234+
tokens: TokenStream::new(vec![tokenstream::TokenTree::token_alone(
235+
token::TokenKind::Ident(sym::eii_macro, token::IdentIsRaw::No),
236+
span,
237+
)]),
238+
}),
241239
tokens: None,
242-
})),
243-
id: ecx.sess.psess.attr_id_generator.mk_attr_id(),
244-
style: ast::AttrStyle::Outer,
245-
span,
246-
},
247-
]),
240+
},
241+
tokens: None,
242+
})),
243+
id: ecx.sess.psess.attr_id_generator.mk_attr_id(),
244+
style: ast::AttrStyle::Outer,
245+
span,
246+
},
247+
);
248+
249+
let macro_def = Annotatable::Item(P(ast::Item {
250+
attrs: macro_attrs,
248251
id: ast::DUMMY_NODE_ID,
249252
span,
250253
// pub

0 commit comments

Comments
 (0)