diff options
| author | David Tolnay <dtolnay@gmail.com> | 2019-11-29 18:46:09 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-29 18:46:09 -0800 |
| commit | b14d9c21203ea79035bf4a8a8a68ad34658a265f (patch) | |
| tree | 03ce6db2344426871cedabbc4c4bf81ee243fa28 /src/test/codegen/src-hash-algorithm | |
| parent | 27710d28b7779200fcd0b3a91a0713374d3e6854 (diff) | |
| parent | 423a5d3e858630e549640763d9022c18bdd68f7a (diff) | |
| download | rust-b14d9c21203ea79035bf4a8a8a68ad34658a265f.tar.gz rust-b14d9c21203ea79035bf4a8a8a68ad34658a265f.zip | |
Rollup merge of #66847 - dtolnay:_fmt, r=joshtriplett
Allow any identifier as format arg name
Previously:
```console
error: invalid format string: invalid argument name `_x`
--> src/main.rs:2:16
|
2 | println!("{_x}", _x=0);
| ^^ invalid argument name in format string
|
= note: argument names cannot start with an underscore
```
Not supporting identifiers starting with underscore appears to have been an arbitrary limitation from 2013 in code that was most likely never reviewed: https://github.com/rust-lang/rust/pull/8245/files#diff-0347868ef389c805e97636623e4a4ea6R277
The error message was dutifully improved in #50610 but is there any reason that leading underscore would be a special case?
This commit updates the format_args parser to accept identifiers with leading underscores.
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
