-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #265 from dtolnay/fallbackfixme
Add test looking for invalid input to still generate an impl
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |