Skip to content

Commit 2e43d26

Browse files
committed
Merge 1.x (1.0.69) into 2.x (master)
2 parents 1048a35 + 41938bd commit 2e43d26

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

impl/src/fmt.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::ast::{ContainerKind, Field};
22
use crate::attr::{Display, Trait};
33
use crate::scan_expr::scan_expr;
44
use crate::unraw::{IdentUnraw, MemberUnraw};
5-
use proc_macro2::{Delimiter, TokenStream};
5+
use proc_macro2::{Delimiter, TokenStream, TokenTree};
66
use quote::{format_ident, quote, quote_spanned};
77
use std::collections::{BTreeSet, HashMap, HashSet};
88
use std::iter;
@@ -225,6 +225,8 @@ fn fallback_explicit_named_args(input: ParseStream) -> Result<FmtArguments> {
225225
let ident: IdentUnraw = input.parse()?;
226226
input.parse::<Token![=]>()?;
227227
args.named.insert(ident);
228+
} else {
229+
input.parse::<TokenTree>()?;
228230
}
229231
}
230232

tests/ui/expression-fallback.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use thiserror::Error;
2+
3+
#[derive(Error, Debug)]
4+
#[error("".yellow)]
5+
pub struct ArgError;
6+
7+
fn main() {}

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)