summaryrefslogtreecommitdiffstats
path: root/vendor/thiserror/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/thiserror/tests')
-rw-r--r--vendor/thiserror/tests/compiletest.rs3
-rw-r--r--vendor/thiserror/tests/test_backtrace.rs41
-rw-r--r--vendor/thiserror/tests/test_display.rs2
-rw-r--r--vendor/thiserror/tests/test_error.rs1
-rw-r--r--vendor/thiserror/tests/test_expr.rs3
-rw-r--r--vendor/thiserror/tests/test_from.rs2
-rw-r--r--vendor/thiserror/tests/test_generics.rs2
-rw-r--r--vendor/thiserror/tests/test_option.rs6
-rw-r--r--vendor/thiserror/tests/test_path.rs2
-rw-r--r--vendor/thiserror/tests/test_source.rs2
-rw-r--r--vendor/thiserror/tests/test_transparent.rs2
-rw-r--r--vendor/thiserror/tests/ui/concat-display.stderr2
-rw-r--r--vendor/thiserror/tests/ui/from-backtrace-backtrace.rs10
-rw-r--r--vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr5
-rw-r--r--vendor/thiserror/tests/ui/no-display.stderr12
-rw-r--r--vendor/thiserror/tests/ui/source-enum-not-error.stderr44
-rw-r--r--vendor/thiserror/tests/ui/source-struct-not-error.stderr42
17 files changed, 85 insertions, 96 deletions
diff --git a/vendor/thiserror/tests/compiletest.rs b/vendor/thiserror/tests/compiletest.rs
index 641d03cbf..7974a6249 100644
--- a/vendor/thiserror/tests/compiletest.rs
+++ b/vendor/thiserror/tests/compiletest.rs
@@ -1,6 +1,5 @@
-#![deny(clippy::all, clippy::pedantic)]
-
#[rustversion::attr(not(nightly), ignore)]
+#[cfg_attr(miri, ignore)]
#[test]
fn ui() {
let t = trybuild::TestCases::new();
diff --git a/vendor/thiserror/tests/test_backtrace.rs b/vendor/thiserror/tests/test_backtrace.rs
index 42e37ca16..052c6f481 100644
--- a/vendor/thiserror/tests/test_backtrace.rs
+++ b/vendor/thiserror/tests/test_backtrace.rs
@@ -1,4 +1,7 @@
-#![cfg_attr(thiserror_nightly_testing, feature(backtrace))]
+#![cfg_attr(
+ thiserror_nightly_testing,
+ feature(error_generic_member_access, provide_any)
+)]
use thiserror::Error;
@@ -16,8 +19,8 @@ pub struct InnerBacktrace {
#[cfg(thiserror_nightly_testing)]
pub mod structs {
use super::{Inner, InnerBacktrace};
+ use std::any;
use std::backtrace::Backtrace;
- use std::error::Error;
use std::sync::Arc;
use thiserror::Error;
@@ -88,44 +91,44 @@ pub mod structs {
let error = PlainBacktrace {
backtrace: Backtrace::capture(),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ExplicitBacktrace {
backtrace: Backtrace::capture(),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = OptBacktrace {
backtrace: Some(Backtrace::capture()),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ArcBacktrace {
backtrace: Arc::new(Backtrace::capture()),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = BacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = CombinedBacktraceFrom::from(InnerBacktrace {
backtrace: Backtrace::capture(),
});
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = OptBacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ArcBacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
}
}
#[cfg(thiserror_nightly_testing)]
pub mod enums {
use super::{Inner, InnerBacktrace};
+ use std::any;
use std::backtrace::Backtrace;
- use std::error::Error;
use std::sync::Arc;
use thiserror::Error;
@@ -210,36 +213,36 @@ pub mod enums {
let error = PlainBacktrace::Test {
backtrace: Backtrace::capture(),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ExplicitBacktrace::Test {
backtrace: Backtrace::capture(),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = OptBacktrace::Test {
backtrace: Some(Backtrace::capture()),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ArcBacktrace::Test {
backtrace: Arc::new(Backtrace::capture()),
};
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = BacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = CombinedBacktraceFrom::from(InnerBacktrace {
backtrace: Backtrace::capture(),
});
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = OptBacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
let error = ArcBacktraceFrom::from(Inner);
- assert!(error.backtrace().is_some());
+ assert!(any::request_ref::<Backtrace>(&error).is_some());
}
}
diff --git a/vendor/thiserror/tests/test_display.rs b/vendor/thiserror/tests/test_display.rs
index 949d9eda7..8917bb054 100644
--- a/vendor/thiserror/tests/test_display.rs
+++ b/vendor/thiserror/tests/test_display.rs
@@ -1,5 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
-
use std::fmt::Display;
use thiserror::Error;
diff --git a/vendor/thiserror/tests/test_error.rs b/vendor/thiserror/tests/test_error.rs
index ece7f91a9..fab934d78 100644
--- a/vendor/thiserror/tests/test_error.rs
+++ b/vendor/thiserror/tests/test_error.rs
@@ -1,4 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
#![allow(dead_code)]
use std::fmt::{self, Display};
diff --git a/vendor/thiserror/tests/test_expr.rs b/vendor/thiserror/tests/test_expr.rs
index 87a56cf58..34de56087 100644
--- a/vendor/thiserror/tests/test_expr.rs
+++ b/vendor/thiserror/tests/test_expr.rs
@@ -1,5 +1,4 @@
-#![deny(clippy::all, clippy::pedantic)]
-#![allow(clippy::option_if_let_else)]
+#![allow(clippy::iter_cloned_collect, clippy::option_if_let_else)]
use std::fmt::Display;
use thiserror::Error;
diff --git a/vendor/thiserror/tests/test_from.rs b/vendor/thiserror/tests/test_from.rs
index a25ce353d..1f387055f 100644
--- a/vendor/thiserror/tests/test_from.rs
+++ b/vendor/thiserror/tests/test_from.rs
@@ -1,5 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
-
use std::io;
use thiserror::Error;
diff --git a/vendor/thiserror/tests/test_generics.rs b/vendor/thiserror/tests/test_generics.rs
index f5e1de243..4ab9f3778 100644
--- a/vendor/thiserror/tests/test_generics.rs
+++ b/vendor/thiserror/tests/test_generics.rs
@@ -1,4 +1,4 @@
-#![deny(clippy::all, clippy::pedantic)]
+#![allow(clippy::needless_late_init)]
use std::fmt::{self, Debug, Display};
use thiserror::Error;
diff --git a/vendor/thiserror/tests/test_option.rs b/vendor/thiserror/tests/test_option.rs
index ca2171385..ed5287dc9 100644
--- a/vendor/thiserror/tests/test_option.rs
+++ b/vendor/thiserror/tests/test_option.rs
@@ -1,5 +1,7 @@
-#![cfg_attr(thiserror_nightly_testing, feature(backtrace))]
-#![deny(clippy::all, clippy::pedantic)]
+#![cfg_attr(
+ thiserror_nightly_testing,
+ feature(error_generic_member_access, provide_any)
+)]
#[cfg(thiserror_nightly_testing)]
pub mod structs {
diff --git a/vendor/thiserror/tests/test_path.rs b/vendor/thiserror/tests/test_path.rs
index a10b1f342..a34a3d74e 100644
--- a/vendor/thiserror/tests/test_path.rs
+++ b/vendor/thiserror/tests/test_path.rs
@@ -1,5 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
-
use ref_cast::RefCast;
use std::fmt::Display;
use std::path::{Path, PathBuf};
diff --git a/vendor/thiserror/tests/test_source.rs b/vendor/thiserror/tests/test_source.rs
index ab16097b2..637f4ac0a 100644
--- a/vendor/thiserror/tests/test_source.rs
+++ b/vendor/thiserror/tests/test_source.rs
@@ -1,5 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
-
use std::error::Error as StdError;
use std::io;
use thiserror::Error;
diff --git a/vendor/thiserror/tests/test_transparent.rs b/vendor/thiserror/tests/test_transparent.rs
index 84d7c9189..6f3c03ec7 100644
--- a/vendor/thiserror/tests/test_transparent.rs
+++ b/vendor/thiserror/tests/test_transparent.rs
@@ -1,5 +1,3 @@
-#![deny(clippy::all, clippy::pedantic)]
-
use anyhow::anyhow;
use std::error::Error as _;
use std::io;
diff --git a/vendor/thiserror/tests/ui/concat-display.stderr b/vendor/thiserror/tests/ui/concat-display.stderr
index 6ab40481f..dbecd69f2 100644
--- a/vendor/thiserror/tests/ui/concat-display.stderr
+++ b/vendor/thiserror/tests/ui/concat-display.stderr
@@ -5,6 +5,6 @@ error: expected string literal
| ^^^^^^
...
13 | error_type!(Error, "foo");
- | -------------------------- in this macro invocation
+ | ------------------------- in this macro invocation
|
= note: this error originates in the macro `error_type` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs b/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs
new file mode 100644
index 000000000..8f411bf5d
--- /dev/null
+++ b/vendor/thiserror/tests/ui/from-backtrace-backtrace.rs
@@ -0,0 +1,10 @@
+// https://github.com/dtolnay/thiserror/issues/163
+
+use std::backtrace::Backtrace;
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error("...")]
+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
new file mode 100644
index 000000000..55d647b42
--- /dev/null
+++ b/vendor/thiserror/tests/ui/from-backtrace-backtrace.stderr
@@ -0,0 +1,5 @@
+error: deriving From requires no fields other than source and backtrace
+ --> tests/ui/from-backtrace-backtrace.rs:8:18
+ |
+8 | pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace);
+ | ^^^^^^^
diff --git a/vendor/thiserror/tests/ui/no-display.stderr b/vendor/thiserror/tests/ui/no-display.stderr
index e6a52f5e7..82c3eea1c 100644
--- a/vendor/thiserror/tests/ui/no-display.stderr
+++ b/vendor/thiserror/tests/ui/no-display.stderr
@@ -2,7 +2,7 @@ error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its
--> tests/ui/no-display.rs:7:9
|
4 | struct NoDisplay;
- | ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
+ | ---------------- doesn't satisfy `NoDisplay: std::fmt::Display`
...
7 | #[error("thread: {thread}")]
| ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
@@ -13,11 +13,5 @@ error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its
note: the following trait must be implemented
--> $RUST/core/src/fmt/mod.rs
|
- | / pub trait Display {
- | | /// Formats the value using the given formatter.
- | | ///
- | | /// # Examples
-... |
- | | fn fmt(&self, f: &mut Formatter<'_>) -> Result;
- | | }
- | |_^
+ | pub trait Display {
+ | ^^^^^^^^^^^^^^^^^
diff --git a/vendor/thiserror/tests/ui/source-enum-not-error.stderr b/vendor/thiserror/tests/ui/source-enum-not-error.stderr
index d01cba5b0..da10c6e77 100644
--- a/vendor/thiserror/tests/ui/source-enum-not-error.stderr
+++ b/vendor/thiserror/tests/ui/source-enum-not-error.stderr
@@ -1,28 +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:10:9
+ |
+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`
+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`
note: the following trait must be implemented
- --> $RUST/std/src/error.rs
- |
- | / pub trait Error: Debug + Display {
- | | /// The lower-level source of this error, if any.
- | | ///
- | | /// # Examples
-... |
- | | }
- | | }
- | |_^
+ --> $RUST/core/src/error.rs
+ |
+ | pub trait Error: Debug + Display {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/vendor/thiserror/tests/ui/source-struct-not-error.stderr b/vendor/thiserror/tests/ui/source-struct-not-error.stderr
index be1331a50..cc0e67aca 100644
--- a/vendor/thiserror/tests/ui/source-struct-not-error.stderr
+++ b/vendor/thiserror/tests/ui/source-struct-not-error.stderr
@@ -1,27 +1,21 @@
error[E0599]: the method `as_dyn_error` exists for struct `NotError`, but its trait bounds were not satisfied
- --> tests/ui/source-struct-not-error.rs:9:5
- |
-4 | struct NotError;
- | ----------------
- | |
- | method `as_dyn_error` not found for this
- | doesn't satisfy `NotError: AsDynError`
- | doesn't satisfy `NotError: std::error::Error`
+ --> tests/ui/source-struct-not-error.rs:9:5
+ |
+4 | struct NotError;
+ | ---------------
+ | |
+ | method `as_dyn_error` not found for this struct
+ | doesn't satisfy `NotError: AsDynError`
+ | doesn't satisfy `NotError: std::error::Error`
...
-9 | 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`
+9 | 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 following trait must be implemented
- --> $RUST/std/src/error.rs
- |
- | / pub trait Error: Debug + Display {
- | | /// The lower-level source of this error, if any.
- | | ///
- | | /// # Examples
-... |
- | | }
- | | }
- | |_^
+ --> $RUST/core/src/error.rs
+ |
+ | pub trait Error: Debug + Display {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^