diff --git a/tests/ui/invalid-input-impl-anyway.rs b/tests/ui/invalid-input-impl-anyway.rs new file mode 100644 index 0000000..f9a10d8 --- /dev/null +++ b/tests/ui/invalid-input-impl-anyway.rs @@ -0,0 +1,11 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error] +pub struct MyError; + +fn main() { + // FIXME: there should be no error on the following line. Thiserror should + // emit an Error impl regardless of the bad attribute. + _ = &MyError as &dyn std::error::Error; +} diff --git a/tests/ui/invalid-input-impl-anyway.stderr b/tests/ui/invalid-input-impl-anyway.stderr new file mode 100644 index 0000000..297b100 --- /dev/null +++ b/tests/ui/invalid-input-impl-anyway.stderr @@ -0,0 +1,13 @@ +error: expected attribute arguments in parentheses: #[error(...)] + --> tests/ui/invalid-input-impl-anyway.rs:4:3 + | +4 | #[error] + | ^^^^^ + +error[E0277]: the trait bound `MyError: std::error::Error` is not satisfied + --> tests/ui/invalid-input-impl-anyway.rs:10:9 + | +10 | _ = &MyError as &dyn std::error::Error; + | ^^^^^^^^ the trait `std::error::Error` is not implemented for `MyError` + | + = note: required for the cast from `&MyError` to `&dyn std::error::Error`