diff options
| author | bors <bors@rust-lang.org> | 2019-06-12 07:38:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-12 07:38:01 +0000 |
| commit | 3f511ade5b0bc42028e42b81392feec770d90ead (patch) | |
| tree | cb5c0d96ce58721918115a689274280c0de8e722 /src/libsyntax/parse/diagnostics.rs | |
| parent | c4797fa4f4a696b183b3aa1517ee22c78d0f5d7a (diff) | |
| parent | 1eaaf440d5173f090d6e937f4b4cffec6c038984 (diff) | |
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
Diffstat (limited to 'src/libsyntax/parse/diagnostics.rs')
| -rw-r--r-- | src/libsyntax/parse/diagnostics.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 9d2ac5b4b51..60544cca877 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -28,7 +28,7 @@ crate fn dummy_arg(ident: Ident) -> Arg { span: ident.span, id: ast::DUMMY_NODE_ID }; - Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID } + Arg { attrs: ThinVec::default(), id: ast::DUMMY_NODE_ID, pat, ty: P(ty) } } pub enum Error { @@ -1074,11 +1074,11 @@ impl<'a> Parser<'a> { Err(err) } - crate fn eat_incorrect_doc_comment(&mut self, applied_to: &str) { + crate fn eat_incorrect_doc_comment_for_arg_type(&mut self) { if let token::DocComment(_) = self.token.kind { let mut err = self.diagnostic().struct_span_err( self.token.span, - &format!("documentation comments cannot be applied to {}", applied_to), + "documentation comments cannot be applied to a function parameter's type", ); err.span_label(self.token.span, "doc comments are not allowed here"); err.emit(); @@ -1095,7 +1095,7 @@ impl<'a> Parser<'a> { self.bump(); let mut err = self.diagnostic().struct_span_err( sp, - &format!("attributes cannot be applied to {}", applied_to), + "attributes cannot be applied to a function parameter's type", ); err.span_label(sp, "attributes are not allowed here"); err.emit(); |
