Skip to content

Commit

Permalink
Fix fallback fmt expression parser hang
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 10, 2024
1 parent 5b36e37 commit 591a44d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions impl/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ fn fallback_explicit_named_args(input: ParseStream) -> Result<FmtArguments> {
let ident = input.call(Ident::parse_any)?;
input.parse::<Token![=]>()?;
args.named.insert(ident);
} else {
input.parse::<TokenTree>()?;
}
}

Expand Down
19 changes: 19 additions & 0 deletions tests/ui/expression-fallback.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error: expected `,`, found `.`
--> tests/ui/expression-fallback.rs:4:11
|
4 | #[error("".yellow)]
| ^ expected `,`

error: argument never used
--> tests/ui/expression-fallback.rs:4:12
|
4 | #[error("".yellow)]
| -- ^^^^^^ argument never used
| |
| formatting specifier missing

error[E0425]: cannot find value `yellow` in this scope
--> tests/ui/expression-fallback.rs:4:12
|
4 | #[error("".yellow)]
| ^^^^^^ not found in this scope

0 comments on commit 591a44d

Please sign in to comment.