Skip to content

Generic unit variants are handled incorrectly inside format args #332

Open
@dtolnay

Description

The following is a valid format expression, but thiserror fails to compile it.

use thiserror::Error;

#[derive(Debug, Error)]
#[error("{}", None::<i32>.is_some())]
pub struct Error;

fn main() {
    println!("{}", None::<i32>.is_some());
}
error: expected one of `!`, `,`, `.`, `::`, `?`, `{`, or an operator, found `is_some`
 --> src/main.rs:4:27
  |
4 | #[error("{}", None::<i32>.is_some())]
  |                           ^^^^^^^ expected one of 7 possible tokens

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions