diff options
Diffstat (limited to 'vendor/thiserror/tests')
20 files changed, 225 insertions, 29 deletions
diff --git a/vendor/thiserror/tests/test_display.rs b/vendor/thiserror/tests/test_display.rs index 99ce2fded..6f603882e 100644 --- a/vendor/thiserror/tests/test_display.rs +++ b/vendor/thiserror/tests/test_display.rs @@ -1,3 +1,5 @@ +#![allow(clippy::uninlined_format_args)] + use std::fmt::{self, Display}; use thiserror::Error; diff --git a/vendor/thiserror/tests/test_expr.rs b/vendor/thiserror/tests/test_expr.rs index 34de56087..8db097bac 100644 --- a/vendor/thiserror/tests/test_expr.rs +++ b/vendor/thiserror/tests/test_expr.rs @@ -1,4 +1,8 @@ -#![allow(clippy::iter_cloned_collect, clippy::option_if_let_else)] +#![allow( + clippy::iter_cloned_collect, + clippy::option_if_let_else, + clippy::uninlined_format_args +)] use std::fmt::Display; use thiserror::Error; diff --git a/vendor/thiserror/tests/test_generics.rs b/vendor/thiserror/tests/test_generics.rs index 4ab9f3778..c94d95ef8 100644 --- a/vendor/thiserror/tests/test_generics.rs +++ b/vendor/thiserror/tests/test_generics.rs @@ -1,4 +1,4 @@ -#![allow(clippy::needless_late_init)] +#![allow(clippy::needless_late_init, clippy::uninlined_format_args)] use std::fmt::{self, Debug, Display}; use thiserror::Error; diff --git a/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs b/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs index 8f411bf5d..3b781ac4e 100644 --- a/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs +++ b/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs @@ -5,6 +5,11 @@ use thiserror::Error; #[derive(Error, Debug)] #[error("...")] -pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace); +pub struct Error( + #[from] + #[backtrace] + std::io::Error, + Backtrace, +); fn main() {} diff --git a/vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr b/vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr index 55d647b42..5c0b9a3bf 100644 --- a/vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr +++ b/vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr @@ -1,5 +1,5 @@ error: deriving From requires no fields other than source and backtrace - --> tests/ui/from-backtrace-backtrace.rs:8:18 + --> tests/ui/from-backtrace-backtrace.rs:9:5 | -8 | pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace); - | ^^^^^^^ +9 | #[from] + | ^^^^^^^ diff --git a/vendor/thiserror/tests/ui/no-display.stderr b/vendor/thiserror/tests/ui/no-display.stderr index 76818e1e5..0f47c24b6 100644 --- a/vendor/thiserror/tests/ui/no-display.stderr +++ b/vendor/thiserror/tests/ui/no-display.stderr @@ -9,7 +9,7 @@ error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its | = note: the following trait bounds were not satisfied: `NoDisplay: std::fmt::Display` - which is required by `&NoDisplay: DisplayAsDisplay` + which is required by `&NoDisplay: AsDisplay<'_>` note: the trait `std::fmt::Display` must be implemented --> $RUST/core/src/fmt/mod.rs | diff --git a/vendor/thiserror/tests/ui/source-enum-not-error.rs b/vendor/thiserror/tests/ui/source-enum-not-error.rs index 3eb0d3e86..dae2285b8 100644 --- a/vendor/thiserror/tests/ui/source-enum-not-error.rs +++ b/vendor/thiserror/tests/ui/source-enum-not-error.rs @@ -6,9 +6,7 @@ pub struct NotError; #[derive(Error, Debug)] #[error("...")] pub enum ErrorEnum { - Broken { - source: NotError, - }, + Broken { source: NotError }, } fn main() {} diff --git a/vendor/thiserror/tests/ui/source-enum-not-error.stderr b/vendor/thiserror/tests/ui/source-enum-not-error.stderr index 750c69eb3..4c44742d5 100644 --- a/vendor/thiserror/tests/ui/source-enum-not-error.stderr +++ b/vendor/thiserror/tests/ui/source-enum-not-error.stderr @@ -1,22 +1,22 @@ error[E0599]: the method `as_dyn_error` exists for reference `&NotError`, but its trait bounds were not satisfied - --> tests/ui/source-enum-not-error.rs:10:9 - | -4 | pub struct NotError; - | ------------------- - | | - | doesn't satisfy `NotError: AsDynError<'_>` - | doesn't satisfy `NotError: std::error::Error` + --> tests/ui/source-enum-not-error.rs:9:14 + | +4 | pub struct NotError; + | ------------------- + | | + | doesn't satisfy `NotError: AsDynError<'_>` + | doesn't satisfy `NotError: std::error::Error` ... -10 | source: NotError, - | ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `NotError: std::error::Error` - which is required by `NotError: AsDynError<'_>` - `&NotError: std::error::Error` - which is required by `&NotError: AsDynError<'_>` +9 | Broken { source: NotError }, + | ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `NotError: std::error::Error` + which is required by `NotError: AsDynError<'_>` + `&NotError: std::error::Error` + which is required by `&NotError: AsDynError<'_>` note: the trait `std::error::Error` must be implemented - --> $RUST/core/src/error.rs - | - | pub trait Error: Debug + Display { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + --> $RUST/core/src/error.rs + | + | pub trait Error: Debug + Display { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs b/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs new file mode 100644 index 000000000..a877c2cd0 --- /dev/null +++ b/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs @@ -0,0 +1,12 @@ +use thiserror::Error; + +#[derive(Debug)] +pub struct NotError; + +#[derive(Error, Debug)] +#[error("...")] +pub enum ErrorEnum { + Broken(#[source] NotError), +} + +fn main() {} diff --git a/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr b/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr new file mode 100644 index 000000000..da6d225f8 --- /dev/null +++ b/vendor/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr @@ -0,0 +1,22 @@ +error[E0599]: the method `as_dyn_error` exists for reference `&NotError`, but its trait bounds were not satisfied + --> tests/ui/source-enum-unnamed-field-not-error.rs:9:14 + | +4 | pub struct NotError; + | ------------------- + | | + | doesn't satisfy `NotError: AsDynError<'_>` + | doesn't satisfy `NotError: std::error::Error` +... +9 | Broken(#[source] NotError), + | ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `NotError: std::error::Error` + which is required by `NotError: AsDynError<'_>` + `&NotError: std::error::Error` + which is required by `&NotError: AsDynError<'_>` +note: the trait `std::error::Error` must be implemented + --> $RUST/core/src/error.rs + | + | pub trait Error: Debug + Display { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs b/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs new file mode 100644 index 000000000..160b6b247 --- /dev/null +++ b/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs @@ -0,0 +1,10 @@ +use thiserror::Error; + +#[derive(Debug)] +struct NotError; + +#[derive(Error, Debug)] +#[error("...")] +pub struct ErrorStruct(#[source] NotError); + +fn main() {} diff --git a/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr b/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr new file mode 100644 index 000000000..a23f26823 --- /dev/null +++ b/vendor/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr @@ -0,0 +1,21 @@ +error[E0599]: the method `as_dyn_error` exists for struct `NotError`, but its trait bounds were not satisfied + --> tests/ui/source-struct-unnamed-field-not-error.rs:8:26 + | +4 | struct NotError; + | --------------- + | | + | method `as_dyn_error` not found for this struct + | doesn't satisfy `NotError: AsDynError<'_>` + | doesn't satisfy `NotError: std::error::Error` +... +8 | pub struct ErrorStruct(#[source] NotError); + | ^^^^^^ method cannot be called on `NotError` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `NotError: std::error::Error` + which is required by `NotError: AsDynError<'_>` +note: the trait `std::error::Error` must be implemented + --> $RUST/core/src/error.rs + | + | pub trait Error: Debug + Display { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/vendor/thiserror/tests/ui/transparent-enum-not-error.rs b/vendor/thiserror/tests/ui/transparent-enum-not-error.rs new file mode 100644 index 000000000..80ccfc973 --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-enum-not-error.rs @@ -0,0 +1,9 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum Error { + #[error(transparent)] + Other { message: String }, +} + +fn main() {} diff --git a/vendor/thiserror/tests/ui/transparent-enum-not-error.stderr b/vendor/thiserror/tests/ui/transparent-enum-not-error.stderr new file mode 100644 index 000000000..9be51434a --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-enum-not-error.stderr @@ -0,0 +1,23 @@ +error[E0599]: the method `as_dyn_error` exists for reference `&String`, but its trait bounds were not satisfied + --> tests/ui/transparent-enum-not-error.rs:5:13 + | +5 | #[error(transparent)] + | ^^^^^^^^^^^ method cannot be called on `&String` due to unsatisfied trait bounds + | + ::: $RUST/alloc/src/string.rs + | + | pub struct String { + | ----------------- + | | + | doesn't satisfy `String: AsDynError<'_>` + | doesn't satisfy `String: std::error::Error` + | + = note: the following trait bounds were not satisfied: + `String: std::error::Error` + which is required by `String: AsDynError<'_>` + `&String: std::error::Error` + which is required by `&String: AsDynError<'_>` + `str: Sized` + which is required by `str: AsDynError<'_>` + `str: std::error::Error` + which is required by `str: AsDynError<'_>` diff --git a/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs b/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs new file mode 100644 index 000000000..87c32e0b6 --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs @@ -0,0 +1,9 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum Error { + #[error(transparent)] + Other(String), +} + +fn main() {} diff --git a/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr b/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr new file mode 100644 index 000000000..3d23c3a0e --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr @@ -0,0 +1,23 @@ +error[E0599]: the method `as_dyn_error` exists for reference `&String`, but its trait bounds were not satisfied + --> tests/ui/transparent-enum-unnamed-field-not-error.rs:5:13 + | +5 | #[error(transparent)] + | ^^^^^^^^^^^ method cannot be called on `&String` due to unsatisfied trait bounds + | + ::: $RUST/alloc/src/string.rs + | + | pub struct String { + | ----------------- + | | + | doesn't satisfy `String: AsDynError<'_>` + | doesn't satisfy `String: std::error::Error` + | + = note: the following trait bounds were not satisfied: + `String: std::error::Error` + which is required by `String: AsDynError<'_>` + `&String: std::error::Error` + which is required by `&String: AsDynError<'_>` + `str: Sized` + which is required by `str: AsDynError<'_>` + `str: std::error::Error` + which is required by `str: AsDynError<'_>` diff --git a/vendor/thiserror/tests/ui/transparent-struct-not-error.rs b/vendor/thiserror/tests/ui/transparent-struct-not-error.rs new file mode 100644 index 000000000..811ff5395 --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-struct-not-error.rs @@ -0,0 +1,9 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error(transparent)] +pub struct Error { + message: String, +} + +fn main() {} diff --git a/vendor/thiserror/tests/ui/transparent-struct-not-error.stderr b/vendor/thiserror/tests/ui/transparent-struct-not-error.stderr new file mode 100644 index 000000000..d67a69446 --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-struct-not-error.stderr @@ -0,0 +1,21 @@ +error[E0599]: the method `as_dyn_error` exists for struct `String`, but its trait bounds were not satisfied + --> tests/ui/transparent-struct-not-error.rs:4:9 + | +4 | #[error(transparent)] + | ^^^^^^^^^^^ method cannot be called on `String` due to unsatisfied trait bounds + | + ::: $RUST/alloc/src/string.rs + | + | pub struct String { + | ----------------- + | | + | doesn't satisfy `String: AsDynError<'_>` + | doesn't satisfy `String: std::error::Error` + | + = note: the following trait bounds were not satisfied: + `String: std::error::Error` + which is required by `String: AsDynError<'_>` + `str: Sized` + which is required by `str: AsDynError<'_>` + `str: std::error::Error` + which is required by `str: AsDynError<'_>` diff --git a/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs b/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs new file mode 100644 index 000000000..b4f7fbbfd --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs @@ -0,0 +1,7 @@ +use thiserror::Error; + +#[derive(Error, Debug)] +#[error(transparent)] +pub struct Error(String); + +fn main() {} diff --git a/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr b/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr new file mode 100644 index 000000000..f715a1517 --- /dev/null +++ b/vendor/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr @@ -0,0 +1,21 @@ +error[E0599]: the method `as_dyn_error` exists for struct `String`, but its trait bounds were not satisfied + --> tests/ui/transparent-struct-unnamed-field-not-error.rs:4:9 + | +4 | #[error(transparent)] + | ^^^^^^^^^^^ method cannot be called on `String` due to unsatisfied trait bounds + | + ::: $RUST/alloc/src/string.rs + | + | pub struct String { + | ----------------- + | | + | doesn't satisfy `String: AsDynError<'_>` + | doesn't satisfy `String: std::error::Error` + | + = note: the following trait bounds were not satisfied: + `String: std::error::Error` + which is required by `String: AsDynError<'_>` + `str: Sized` + which is required by `str: AsDynError<'_>` + `str: std::error::Error` + which is required by `str: AsDynError<'_>` |