-
-
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.
Add ui test where fallback impl conflicts with handwritten Display
- Loading branch information
Showing
2 changed files
with
30 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,14 @@ | ||
use std::fmt::{self, Display}; | ||
use thiserror::Error; | ||
|
||
#[derive(Error, Debug)] | ||
#[error] | ||
pub struct MyError; | ||
|
||
impl Display for MyError { | ||
fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { | ||
unimplemented!() | ||
} | ||
} | ||
|
||
fn main() {} |
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,16 @@ | ||
error: expected attribute arguments in parentheses: #[error(...)] | ||
--> tests/ui/fallback-impl-with-display.rs:5:3 | ||
| | ||
5 | #[error] | ||
| ^^^^^ | ||
|
||
error[E0119]: conflicting implementations of trait `std::fmt::Display` for type `MyError` | ||
--> tests/ui/fallback-impl-with-display.rs:4:10 | ||
| | ||
4 | #[derive(Error, Debug)] | ||
| ^^^^^ conflicting implementation for `MyError` | ||
... | ||
8 | impl Display for MyError { | ||
| ------------------------ first implementation here | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |