Skip to content

Commit 591a44d

Browse files
committed
Fix fallback fmt expression parser hang
1 parent 5b36e37 commit 591a44d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

impl/src/fmt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ fn fallback_explicit_named_args(input: ParseStream) -> Result<FmtArguments> {
193193
let ident = input.call(Ident::parse_any)?;
194194
input.parse::<Token![=]>()?;
195195
args.named.insert(ident);
196+
} else {
197+
input.parse::<TokenTree>()?;
196198
}
197199
}
198200

tests/ui/expression-fallback.stderr

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: expected `,`, found `.`
2+
--> tests/ui/expression-fallback.rs:4:11
3+
|
4+
4 | #[error("".yellow)]
5+
| ^ expected `,`
6+
7+
error: argument never used
8+
--> tests/ui/expression-fallback.rs:4:12
9+
|
10+
4 | #[error("".yellow)]
11+
| -- ^^^^^^ argument never used
12+
| |
13+
| formatting specifier missing
14+
15+
error[E0425]: cannot find value `yellow` in this scope
16+
--> tests/ui/expression-fallback.rs:4:12
17+
|
18+
4 | #[error("".yellow)]
19+
| ^^^^^^ not found in this scope

0 commit comments

Comments
 (0)