diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 2183d4cc..08e00fcc 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -37,6 +37,13 @@ fn fallback(input: &DeriveInput, error: syn::Error) -> TokenStream { #[allow(unused_qualifications)] impl #impl_generics std::error::Error for #ty #ty_generics #where_clause {} + + #[allow(unused_qualifications)] + impl #impl_generics ::core::fmt::Display for #ty #ty_generics #where_clause { + fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::unreachable!() + } + } } } diff --git a/tests/ui/bad-field-attr.stderr b/tests/ui/bad-field-attr.stderr index 2476eb5d..5fb57441 100644 --- a/tests/ui/bad-field-attr.stderr +++ b/tests/ui/bad-field-attr.stderr @@ -3,17 +3,3 @@ error: #[error(transparent)] needs to go outside the enum or struct, not on an i | 5 | pub struct Error(#[error(transparent)] std::io::Error); | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/bad-field-attr.rs:5:12 - | -5 | pub struct Error(#[error(transparent)] std::io::Error); - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/concat-display.stderr b/tests/ui/concat-display.stderr index aa49a8c2..dbecd69f 100644 --- a/tests/ui/concat-display.stderr +++ b/tests/ui/concat-display.stderr @@ -8,17 +8,3 @@ error: expected string literal | ------------------------- in this macro invocation | = note: this error originates in the macro `error_type` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/concat-display.rs:13:13 - | -13 | error_type!(Error, "foo"); - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/duplicate-enum-source.stderr b/tests/ui/duplicate-enum-source.stderr index 6a9fc6e0..4a4b2d39 100644 --- a/tests/ui/duplicate-enum-source.stderr +++ b/tests/ui/duplicate-enum-source.stderr @@ -3,17 +3,3 @@ error: duplicate #[source] attribute | 8 | #[source] | ^^^^^^^^^ - -error[E0277]: `ErrorEnum` doesn't implement `std::fmt::Display` - --> tests/ui/duplicate-enum-source.rs:4:10 - | -4 | pub enum ErrorEnum { - | ^^^^^^^^^ `ErrorEnum` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `ErrorEnum` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/duplicate-fmt.stderr b/tests/ui/duplicate-fmt.stderr index dba5ed57..532b16bd 100644 --- a/tests/ui/duplicate-fmt.stderr +++ b/tests/ui/duplicate-fmt.stderr @@ -3,17 +3,3 @@ error: only one #[error(...)] attribute is allowed | 5 | #[error("...")] | ^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/duplicate-fmt.rs:6:12 - | -6 | pub struct Error; - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/duplicate-struct-source.stderr b/tests/ui/duplicate-struct-source.stderr index af9769f6..c8de5747 100644 --- a/tests/ui/duplicate-struct-source.stderr +++ b/tests/ui/duplicate-struct-source.stderr @@ -3,17 +3,3 @@ error: duplicate #[source] attribute | 7 | #[source] | ^^^^^^^^^ - -error[E0277]: `ErrorStruct` doesn't implement `std::fmt::Display` - --> tests/ui/duplicate-struct-source.rs:4:12 - | -4 | pub struct ErrorStruct { - | ^^^^^^^^^^^ `ErrorStruct` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `ErrorStruct` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/duplicate-transparent.stderr b/tests/ui/duplicate-transparent.stderr index 03bda29e..a8308790 100644 --- a/tests/ui/duplicate-transparent.stderr +++ b/tests/ui/duplicate-transparent.stderr @@ -3,17 +3,3 @@ error: duplicate #[error(transparent)] attribute | 5 | #[error(transparent)] | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/duplicate-transparent.rs:6:12 - | -6 | pub struct Error(anyhow::Error); - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/from-backtrace-backtrace.stderr b/tests/ui/from-backtrace-backtrace.stderr index 259aea53..5c0b9a3b 100644 --- a/tests/ui/from-backtrace-backtrace.stderr +++ b/tests/ui/from-backtrace-backtrace.stderr @@ -3,17 +3,3 @@ error: deriving From requires no fields other than source and backtrace | 9 | #[from] | ^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/from-backtrace-backtrace.rs:8:12 - | -8 | pub struct Error( - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/from-not-source.stderr b/tests/ui/from-not-source.stderr index 92f58703..97136017 100644 --- a/tests/ui/from-not-source.stderr +++ b/tests/ui/from-not-source.stderr @@ -3,17 +3,3 @@ error: #[from] is only supported on the source field, not any other field | 7 | #[from] | ^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/from-not-source.rs:4:12 - | -4 | pub struct Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/invalid-input-impl-anyway.stderr b/tests/ui/invalid-input-impl-anyway.stderr index 1b58b6c1..b98c31e9 100644 --- a/tests/ui/invalid-input-impl-anyway.stderr +++ b/tests/ui/invalid-input-impl-anyway.stderr @@ -3,17 +3,3 @@ error: expected attribute arguments in parentheses: #[error(...)] | 4 | #[error] | ^^^^^ - -error[E0277]: `MyError` doesn't implement `std::fmt::Display` - --> tests/ui/invalid-input-impl-anyway.rs:5:12 - | -5 | pub struct MyError; - | ^^^^^^^ `MyError` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `MyError` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/lifetime.stderr b/tests/ui/lifetime.stderr index b2d71380..8b58136e 100644 --- a/tests/ui/lifetime.stderr +++ b/tests/ui/lifetime.stderr @@ -9,31 +9,3 @@ error: non-static lifetimes are not allowed in the source of an error, because s | 15 | Foo(#[from] Generic<&'a str>), | ^^^^^^^^^^^^^^^^ - -error[E0277]: `Error<'a>` doesn't implement `std::fmt::Display` - --> tests/ui/lifetime.rs:6:8 - | -6 | struct Error<'a>(#[from] Inner<'a>); - | ^^^^^^^^^ `Error<'a>` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error<'a>` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` - -error[E0277]: `Enum<'a>` doesn't implement `std::fmt::Display` - --> tests/ui/lifetime.rs:13:6 - | -13 | enum Enum<'a> { - | ^^^^^^^^ `Enum<'a>` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Enum<'a>` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/missing-fmt.stderr b/tests/ui/missing-fmt.stderr index 9f34ff1f..c0be3735 100644 --- a/tests/ui/missing-fmt.stderr +++ b/tests/ui/missing-fmt.stderr @@ -3,17 +3,3 @@ error: missing #[error("...")] display attribute | 7 | B(usize), | ^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/missing-fmt.rs:4:10 - | -4 | pub enum Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/transparent-display.stderr b/tests/ui/transparent-display.stderr index e35d7320..54d958b2 100644 --- a/tests/ui/transparent-display.stderr +++ b/tests/ui/transparent-display.stderr @@ -3,17 +3,3 @@ error: cannot have both #[error(transparent)] and a display attribute | 5 | #[error("...")] | ^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/transparent-display.rs:6:12 - | -6 | pub struct Error(anyhow::Error); - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/transparent-enum-many.stderr b/tests/ui/transparent-enum-many.stderr index 849a8aba..a9adfa5a 100644 --- a/tests/ui/transparent-enum-many.stderr +++ b/tests/ui/transparent-enum-many.stderr @@ -4,17 +4,3 @@ error: #[error(transparent)] requires exactly one field 5 | / #[error(transparent)] 6 | | Other(anyhow::Error, String), | |________________________________^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/transparent-enum-many.rs:4:10 - | -4 | pub enum Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/transparent-enum-source.stderr b/tests/ui/transparent-enum-source.stderr index fb33d127..ccb90677 100644 --- a/tests/ui/transparent-enum-source.stderr +++ b/tests/ui/transparent-enum-source.stderr @@ -3,17 +3,3 @@ error: transparent variant can't contain #[source] | 6 | Other(#[source] anyhow::Error), | ^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/transparent-enum-source.rs:4:10 - | -4 | pub enum Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/transparent-struct-many.stderr b/tests/ui/transparent-struct-many.stderr index add231a6..c0e3806e 100644 --- a/tests/ui/transparent-struct-many.stderr +++ b/tests/ui/transparent-struct-many.stderr @@ -3,17 +3,3 @@ error: #[error(transparent)] requires exactly one field | 4 | #[error(transparent)] | ^^^^^^^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/transparent-struct-many.rs:5:12 - | -5 | pub struct Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/transparent-struct-source.stderr b/tests/ui/transparent-struct-source.stderr index 54d8230e..3012ca31 100644 --- a/tests/ui/transparent-struct-source.stderr +++ b/tests/ui/transparent-struct-source.stderr @@ -3,17 +3,3 @@ error: transparent error struct can't contain #[source] | 5 | pub struct Error(#[source] anyhow::Error); | ^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/transparent-struct-source.rs:5:12 - | -5 | pub struct Error(#[source] anyhow::Error); - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/unexpected-field-fmt.stderr b/tests/ui/unexpected-field-fmt.stderr index 65d4ff9a..bf3c24df 100644 --- a/tests/ui/unexpected-field-fmt.stderr +++ b/tests/ui/unexpected-field-fmt.stderr @@ -3,17 +3,3 @@ error: not expected here; the #[error(...)] attribute belongs on top of a struct | 6 | #[error("...")] | ^^^^^^^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/unexpected-field-fmt.rs:4:10 - | -4 | pub enum Error { - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/unexpected-struct-source.stderr b/tests/ui/unexpected-struct-source.stderr index f075ed89..6f15841d 100644 --- a/tests/ui/unexpected-struct-source.stderr +++ b/tests/ui/unexpected-struct-source.stderr @@ -3,17 +3,3 @@ error: not expected here; the #[source] attribute belongs on a specific field | 4 | #[source] | ^^^^^^^^^ - -error[E0277]: `Error` doesn't implement `std::fmt::Display` - --> tests/ui/unexpected-struct-source.rs:5:12 - | -5 | pub struct Error; - | ^^^^^ `Error` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `Error` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` diff --git a/tests/ui/union.stderr b/tests/ui/union.stderr index d8588ffa..d54931c0 100644 --- a/tests/ui/union.stderr +++ b/tests/ui/union.stderr @@ -7,20 +7,6 @@ error: union as errors are not supported 7 | | } | |_^ -error[E0277]: `U` doesn't implement `std::fmt::Display` - --> tests/ui/union.rs:4:11 - | -4 | pub union U { - | ^ `U` cannot be formatted with the default formatter - | - = help: the trait `std::fmt::Display` is not implemented for `U` - = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead -note: required by a bound in `std::error::Error` - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^ required by this bound in `Error` - error[E0277]: `U` doesn't implement `Debug` --> tests/ui/union.rs:4:11 |