syntax_ext: format: allow multiple formats for one argument
This commit removed the restriction of only allowing one type per argument. This is achieved by adding mappings between macro arguments and format placeholders, then taking the mapping into consideration when emitting the Arguments expression. syntax_ext: format: fix implicit positional arguments syntax_ext: format: don't panic if no args given for implicit positional args Check the list lengths before use. Fixes regression of `compile-fail/macro-backtrace-println.rs`. syntax_ext: format: also map CountIsParam indices to expanded args syntax_ext: format: fix ICE in case of malformed format args
This commit is contained in:
parent
eb5417bf12
commit
5e55a44116
2 changed files with 57 additions and 72 deletions
|
|
@ -23,9 +23,6 @@ fn main() {
|
|||
format!("{foo}", 1, foo=2); //~ ERROR: argument never used
|
||||
format!("", foo=2); //~ ERROR: named argument never used
|
||||
|
||||
format!("{0:x} {0:X}", 1); //~ ERROR: redeclared with type `X`
|
||||
format!("{foo:x} {foo:X}", foo=1); //~ ERROR: redeclared with type `X`
|
||||
|
||||
format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument
|
||||
format!("", foo=1, 2); //~ ERROR: positional arguments cannot follow
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue