Allow attributes before function arguments

This adds support for function calls of the form:

```rust
  (
    #[attr(...)] 1.2,
    #[attr_one(...)]
    #[attr_two(...)]
    1.5,
    ... etc ...
  )
```

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2801
This commit is contained in:
Joshua Nelson 2020-01-12 10:19:17 -05:00
parent f7a7092d69
commit c3ac2c93fb
No known key found for this signature in database
GPG key ID: E655823D8D8B1088
3 changed files with 126 additions and 0 deletions

View file

@ -535,11 +535,22 @@ fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
m.complete(p, CAST_EXPR)
}
// test arg_list
// fn assert_float(s: &str, n: f64) {}
// fn foo() {
// assert_float(
// "1.797693134862315708e+308L",
// #[allow(clippy::excessive_precision)]
// #[allow(dead_code)]
// 1.797_693_134_862_315_730_8e+308,
// );
// }
fn arg_list(p: &mut Parser) {
assert!(p.at(T!['(']));
let m = p.start();
p.bump(T!['(']);
while !p.at(T![')']) && !p.at(EOF) {
attributes::outer_attributes(p);
if !p.at_ts(EXPR_FIRST) {
p.error("expected expression");
break;