diff --git a/tests/ui/display-underscore.rs b/tests/ui/display-underscore.rs new file mode 100644 index 0000000..335614b --- /dev/null +++ b/tests/ui/display-underscore.rs @@ -0,0 +1,7 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error("{_}")] +pub struct Error; + +fn main() {} diff --git a/tests/ui/display-underscore.stderr b/tests/ui/display-underscore.stderr new file mode 100644 index 0000000..36882b9 --- /dev/null +++ b/tests/ui/display-underscore.stderr @@ -0,0 +1,7 @@ +error: invalid format string: invalid argument name `_` + --> tests/ui/display-underscore.rs:4:11 + | +4 | #[error("{_}")] + | ^ invalid argument name in format string + | + = note: argument name cannot be a single underscore