diff options
| author | David Tolnay <dtolnay@gmail.com> | 2019-11-28 10:49:13 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2019-11-28 11:24:51 -0800 |
| commit | 423a5d3e858630e549640763d9022c18bdd68f7a (patch) | |
| tree | 4ab6ba5fa78b57af343e3d16401007b8925eef99 /src/liballoc/alloc | |
| parent | f453d1127d9095cf3c3356655d9e8502ceeb8373 (diff) | |
| download | rust-423a5d3e858630e549640763d9022c18bdd68f7a.tar.gz rust-423a5d3e858630e549640763d9022c18bdd68f7a.zip | |
Allow any identifier as format arg name
Previously:
error: invalid format string: invalid argument name `_x`
--> src/main.rs:2:16
|
2 | println!("{_x}", a=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/liballoc/alloc')
0 files changed, 0 insertions, 0 deletions
