Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkov

Allow attributes in formal function parameters

Implements https://github.com/rust-lang/rust/issues/60406.

This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made.

**TODO**

- [x] Forbid some built-in attributes.
- [x] Expand cfg/cfg_attr
This commit is contained in:
bors 2019-06-12 07:38:01 +00:00
commit 3f511ade5b
28 changed files with 1115 additions and 74 deletions

View file

@ -963,9 +963,10 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
fn arg(&self, span: Span, ident: ast::Ident, ty: P<ast::Ty>) -> ast::Arg {
let arg_pat = self.pat_ident(span, ident);
ast::Arg {
ty,
attrs: ThinVec::default(),
id: ast::DUMMY_NODE_ID,
pat: arg_pat,
id: ast::DUMMY_NODE_ID
ty,
}
}

View file

@ -1578,6 +1578,11 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
*id = self.cx.resolver.next_node_id()
}
}
fn visit_fn_decl(&mut self, mut fn_decl: &mut P<ast::FnDecl>) {
self.cfg.configure_fn_decl(&mut fn_decl);
noop_visit_fn_decl(fn_decl, self);
}
}
pub struct ExpansionConfig<'feat> {