summaryrefslogtreecommitdiffstats
path: root/third_party/rust/thiserror/tests/ui
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/rust/thiserror/tests/ui
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/thiserror/tests/ui')
-rw-r--r--third_party/rust/thiserror/tests/ui/bad-field-attr.rs7
-rw-r--r--third_party/rust/thiserror/tests/ui/bad-field-attr.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/concat-display.rs15
-rw-r--r--third_party/rust/thiserror/tests/ui/concat-display.stderr10
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-enum-source.rs13
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-enum-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-fmt.rs8
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-fmt.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-struct-source.rs11
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-struct-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-transparent.rs8
-rw-r--r--third_party/rust/thiserror/tests/ui/duplicate-transparent.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/fallback-impl-with-display.rs14
-rw-r--r--third_party/rust/thiserror/tests/ui/fallback-impl-with-display.stderr16
-rw-r--r--third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.rs15
-rw-r--r--third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/from-not-source.rs11
-rw-r--r--third_party/rust/thiserror/tests/ui/from-not-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.rs11
-rw-r--r--third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/lifetime.rs24
-rw-r--r--third_party/rust/thiserror/tests/ui/lifetime.stderr11
-rw-r--r--third_party/rust/thiserror/tests/ui/missing-display.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/missing-display.stderr13
-rw-r--r--third_party/rust/thiserror/tests/ui/missing-fmt.rs10
-rw-r--r--third_party/rust/thiserror/tests/ui/missing-fmt.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/no-display.rs12
-rw-r--r--third_party/rust/thiserror/tests/ui/no-display.stderr17
-rw-r--r--third_party/rust/thiserror/tests/ui/source-enum-not-error.rs12
-rw-r--r--third_party/rust/thiserror/tests/ui/source-enum-not-error.stderr22
-rw-r--r--third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs12
-rw-r--r--third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr22
-rw-r--r--third_party/rust/thiserror/tests/ui/source-struct-not-error.rs12
-rw-r--r--third_party/rust/thiserror/tests/ui/source-struct-not-error.stderr21
-rw-r--r--third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs10
-rw-r--r--third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr21
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-display.rs8
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-display.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-many.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-many.stderr6
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-not-error.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-not-error.stderr23
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-source.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr23
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-many.rs10
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-many.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-not-error.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-not-error.stderr21
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-source.rs7
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs7
-rw-r--r--third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr21
-rw-r--r--third_party/rust/thiserror/tests/ui/unexpected-field-fmt.rs11
-rw-r--r--third_party/rust/thiserror/tests/ui/unexpected-field-fmt.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/unexpected-struct-source.rs7
-rw-r--r--third_party/rust/thiserror/tests/ui/unexpected-struct-source.stderr5
-rw-r--r--third_party/rust/thiserror/tests/ui/union.rs9
-rw-r--r--third_party/rust/thiserror/tests/ui/union.stderr8
60 files changed, 648 insertions, 0 deletions
diff --git a/third_party/rust/thiserror/tests/ui/bad-field-attr.rs b/third_party/rust/thiserror/tests/ui/bad-field-attr.rs
new file mode 100644
index 0000000000..d5429b2b26
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/bad-field-attr.rs
@@ -0,0 +1,7 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error(transparent)]
+pub struct Error(#[error(transparent)] std::io::Error);
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/bad-field-attr.stderr b/third_party/rust/thiserror/tests/ui/bad-field-attr.stderr
new file mode 100644
index 0000000000..5fb5744156
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/bad-field-attr.stderr
@@ -0,0 +1,5 @@
+error: #[error(transparent)] needs to go outside the enum or struct, not on an individual field
+ --> tests/ui/bad-field-attr.rs:5:18
+ |
+5 | pub struct Error(#[error(transparent)] std::io::Error);
+ | ^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/concat-display.rs b/third_party/rust/thiserror/tests/ui/concat-display.rs
new file mode 100644
index 0000000000..8b53cc0cd9
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/concat-display.rs
@@ -0,0 +1,15 @@
+use thiserror::Error;
+
+macro_rules! error_type {
+ ($name:ident, $what:expr) => {
+ // Use #[error("invalid {}", $what)] instead.
+
+ #[derive(Error, Debug)]
+ #[error(concat!("invalid ", $what))]
+ pub struct $name;
+ };
+}
+
+error_type!(Error, "foo");
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/concat-display.stderr b/third_party/rust/thiserror/tests/ui/concat-display.stderr
new file mode 100644
index 0000000000..dbecd69f2b
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/concat-display.stderr
@@ -0,0 +1,10 @@
+error: expected string literal
+ --> tests/ui/concat-display.rs:8:17
+ |
+8 | #[error(concat!("invalid ", $what))]
+ | ^^^^^^
+...
+13 | error_type!(Error, "foo");
+ | ------------------------- 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/third_party/rust/thiserror/tests/ui/duplicate-enum-source.rs b/third_party/rust/thiserror/tests/ui/duplicate-enum-source.rs
new file mode 100644
index 0000000000..15e579f8fa
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-enum-source.rs
@@ -0,0 +1,13 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum ErrorEnum {
+ Confusing {
+ #[source]
+ a: std::io::Error,
+ #[source]
+ b: anyhow::Error,
+ },
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-enum-source.stderr b/third_party/rust/thiserror/tests/ui/duplicate-enum-source.stderr
new file mode 100644
index 0000000000..4a4b2d3989
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-enum-source.stderr
@@ -0,0 +1,5 @@
+error: duplicate #[source] attribute
+ --> tests/ui/duplicate-enum-source.rs:8:9
+ |
+8 | #[source]
+ | ^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-fmt.rs b/third_party/rust/thiserror/tests/ui/duplicate-fmt.rs
new file mode 100644
index 0000000000..cb3d67881f
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-fmt.rs
@@ -0,0 +1,8 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error("...")]
+#[error("...")]
+pub struct Error;
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-fmt.stderr b/third_party/rust/thiserror/tests/ui/duplicate-fmt.stderr
new file mode 100644
index 0000000000..532b16bdb6
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-fmt.stderr
@@ -0,0 +1,5 @@
+error: only one #[error(...)] attribute is allowed
+ --> tests/ui/duplicate-fmt.rs:5:1
+ |
+5 | #[error("...")]
+ | ^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-struct-source.rs b/third_party/rust/thiserror/tests/ui/duplicate-struct-source.rs
new file mode 100644
index 0000000000..569df8dd40
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-struct-source.rs
@@ -0,0 +1,11 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub struct ErrorStruct {
+ #[source]
+ a: std::io::Error,
+ #[source]
+ b: anyhow::Error,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-struct-source.stderr b/third_party/rust/thiserror/tests/ui/duplicate-struct-source.stderr
new file mode 100644
index 0000000000..c8de5747df
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-struct-source.stderr
@@ -0,0 +1,5 @@
+error: duplicate #[source] attribute
+ --> tests/ui/duplicate-struct-source.rs:7:5
+ |
+7 | #[source]
+ | ^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-transparent.rs b/third_party/rust/thiserror/tests/ui/duplicate-transparent.rs
new file mode 100644
index 0000000000..49c0e46679
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-transparent.rs
@@ -0,0 +1,8 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error(transparent)]
+#[error(transparent)]
+pub struct Error(anyhow::Error);
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/duplicate-transparent.stderr b/third_party/rust/thiserror/tests/ui/duplicate-transparent.stderr
new file mode 100644
index 0000000000..a8308790e0
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/duplicate-transparent.stderr
@@ -0,0 +1,5 @@
+error: duplicate #[error(transparent)] attribute
+ --> tests/ui/duplicate-transparent.rs:5:1
+ |
+5 | #[error(transparent)]
+ | ^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.rs b/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.rs
new file mode 100644
index 0000000000..3341187315
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.rs
@@ -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() {}
diff --git a/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.stderr b/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.stderr
new file mode 100644
index 0000000000..6bd3730731
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/fallback-impl-with-display.stderr
@@ -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)
diff --git a/third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.rs b/third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.rs
new file mode 100644
index 0000000000..3b781ac4e1
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.rs
@@ -0,0 +1,15 @@
+// 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/third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.stderr b/third_party/rust/thiserror/tests/ui/from-backtrace-backtrace.stderr
new file mode 100644
index 0000000000..5c0b9a3bfa
--- /dev/null
+++ b/third_party/rust/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:9:5
+ |
+9 | #[from]
+ | ^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/from-not-source.rs b/third_party/rust/thiserror/tests/ui/from-not-source.rs
new file mode 100644
index 0000000000..d1855bec5c
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/from-not-source.rs
@@ -0,0 +1,11 @@
+use thiserror::Error;
+
+#[derive(Debug, Error)]
+pub struct Error {
+ #[source]
+ source: std::io::Error,
+ #[from]
+ other: anyhow::Error,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/from-not-source.stderr b/third_party/rust/thiserror/tests/ui/from-not-source.stderr
new file mode 100644
index 0000000000..97136017df
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/from-not-source.stderr
@@ -0,0 +1,5 @@
+error: #[from] is only supported on the source field, not any other field
+ --> tests/ui/from-not-source.rs:7:5
+ |
+7 | #[from]
+ | ^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.rs b/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.rs
new file mode 100644
index 0000000000..0a0bcbee8e
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.rs
@@ -0,0 +1,11 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error]
+pub struct MyError;
+
+fn main() {
+ // No error on the following line. Thiserror emits an Error impl despite the
+ // bad attribute.
+ _ = &MyError as &dyn std::error::Error;
+}
diff --git a/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.stderr b/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.stderr
new file mode 100644
index 0000000000..b98c31e9c6
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/invalid-input-impl-anyway.stderr
@@ -0,0 +1,5 @@
+error: expected attribute arguments in parentheses: #[error(...)]
+ --> tests/ui/invalid-input-impl-anyway.rs:4:3
+ |
+4 | #[error]
+ | ^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/lifetime.rs b/third_party/rust/thiserror/tests/ui/lifetime.rs
new file mode 100644
index 0000000000..698f8c4e8a
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/lifetime.rs
@@ -0,0 +1,24 @@
+use std::fmt::Debug;
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error("error")]
+struct Error<'a>(#[from] Inner<'a>);
+
+#[derive(Error, Debug)]
+#[error("{0}")]
+struct Inner<'a>(&'a str);
+
+#[derive(Error, Debug)]
+enum Enum<'a> {
+ #[error("error")]
+ Foo(#[from] Generic<&'a str>),
+}
+
+#[derive(Error, Debug)]
+#[error("{0:?}")]
+struct Generic<T: Debug>(T);
+
+fn main() -> Result<(), Error<'static>> {
+ Err(Error(Inner("some text")))
+}
diff --git a/third_party/rust/thiserror/tests/ui/lifetime.stderr b/third_party/rust/thiserror/tests/ui/lifetime.stderr
new file mode 100644
index 0000000000..8b58136e52
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/lifetime.stderr
@@ -0,0 +1,11 @@
+error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
+ --> tests/ui/lifetime.rs:6:26
+ |
+6 | struct Error<'a>(#[from] Inner<'a>);
+ | ^^^^^^^^^
+
+error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
+ --> tests/ui/lifetime.rs:15:17
+ |
+15 | Foo(#[from] Generic<&'a str>),
+ | ^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/missing-display.rs b/third_party/rust/thiserror/tests/ui/missing-display.rs
new file mode 100644
index 0000000000..31e23fe683
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/missing-display.rs
@@ -0,0 +1,9 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum MyError {
+ First,
+ Second,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/missing-display.stderr b/third_party/rust/thiserror/tests/ui/missing-display.stderr
new file mode 100644
index 0000000000..48c9ded9fa
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/missing-display.stderr
@@ -0,0 +1,13 @@
+error[E0277]: `MyError` doesn't implement `std::fmt::Display`
+ --> tests/ui/missing-display.rs:4:10
+ |
+4 | pub enum 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/third_party/rust/thiserror/tests/ui/missing-fmt.rs b/third_party/rust/thiserror/tests/ui/missing-fmt.rs
new file mode 100644
index 0000000000..d52fbdf0d9
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/missing-fmt.rs
@@ -0,0 +1,10 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum Error {
+ #[error("...")]
+ A(usize),
+ B(usize),
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/missing-fmt.stderr b/third_party/rust/thiserror/tests/ui/missing-fmt.stderr
new file mode 100644
index 0000000000..c0be37357e
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/missing-fmt.stderr
@@ -0,0 +1,5 @@
+error: missing #[error("...")] display attribute
+ --> tests/ui/missing-fmt.rs:7:5
+ |
+7 | B(usize),
+ | ^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/no-display.rs b/third_party/rust/thiserror/tests/ui/no-display.rs
new file mode 100644
index 0000000000..181a66e02c
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/no-display.rs
@@ -0,0 +1,12 @@
+use thiserror::Error;
+
+#[derive(Debug)]
+struct NoDisplay;
+
+#[derive(Error, Debug)]
+#[error("thread: {thread}")]
+pub struct Error {
+ thread: NoDisplay,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/no-display.stderr b/third_party/rust/thiserror/tests/ui/no-display.stderr
new file mode 100644
index 0000000000..0f47c24b62
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/no-display.stderr
@@ -0,0 +1,17 @@
+error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its trait bounds were not satisfied
+ --> tests/ui/no-display.rs:7:9
+ |
+4 | struct NoDisplay;
+ | ---------------- doesn't satisfy `NoDisplay: std::fmt::Display`
+...
+7 | #[error("thread: {thread}")]
+ | ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
+ |
+ = note: the following trait bounds were not satisfied:
+ `NoDisplay: std::fmt::Display`
+ which is required by `&NoDisplay: AsDisplay<'_>`
+note: the trait `std::fmt::Display` must be implemented
+ --> $RUST/core/src/fmt/mod.rs
+ |
+ | pub trait Display {
+ | ^^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/source-enum-not-error.rs b/third_party/rust/thiserror/tests/ui/source-enum-not-error.rs
new file mode 100644
index 0000000000..dae2285b83
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/source-enum-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/third_party/rust/thiserror/tests/ui/source-enum-not-error.stderr b/third_party/rust/thiserror/tests/ui/source-enum-not-error.stderr
new file mode 100644
index 0000000000..4c44742d54
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/source-enum-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-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/third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs b/third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.rs
new file mode 100644
index 0000000000..a877c2cd0f
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr b/third_party/rust/thiserror/tests/ui/source-enum-unnamed-field-not-error.stderr
new file mode 100644
index 0000000000..da6d225f86
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/source-struct-not-error.rs b/third_party/rust/thiserror/tests/ui/source-struct-not-error.rs
new file mode 100644
index 0000000000..d59df1eef8
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/source-struct-not-error.rs
@@ -0,0 +1,12 @@
+use thiserror::Error;
+
+#[derive(Debug)]
+struct NotError;
+
+#[derive(Error, Debug)]
+#[error("...")]
+pub struct ErrorStruct {
+ source: NotError,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/source-struct-not-error.stderr b/third_party/rust/thiserror/tests/ui/source-struct-not-error.stderr
new file mode 100644
index 0000000000..b98460fcbe
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/source-struct-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-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<'_>`
+note: the trait `std::error::Error` must be implemented
+ --> $RUST/core/src/error.rs
+ |
+ | pub trait Error: Debug + Display {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs b/third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.rs
new file mode 100644
index 0000000000..160b6b247f
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr b/third_party/rust/thiserror/tests/ui/source-struct-unnamed-field-not-error.stderr
new file mode 100644
index 0000000000..a23f26823f
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-display.rs b/third_party/rust/thiserror/tests/ui/transparent-display.rs
new file mode 100644
index 0000000000..2a59f183ba
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-display.rs
@@ -0,0 +1,8 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error(transparent)]
+#[error("...")]
+pub struct Error(anyhow::Error);
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/transparent-display.stderr b/third_party/rust/thiserror/tests/ui/transparent-display.stderr
new file mode 100644
index 0000000000..54d958b278
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-display.stderr
@@ -0,0 +1,5 @@
+error: cannot have both #[error(transparent)] and a display attribute
+ --> tests/ui/transparent-display.rs:5:1
+ |
+5 | #[error("...")]
+ | ^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/transparent-enum-many.rs b/third_party/rust/thiserror/tests/ui/transparent-enum-many.rs
new file mode 100644
index 0000000000..e2a73a4700
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-enum-many.rs
@@ -0,0 +1,9 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum Error {
+ #[error(transparent)]
+ Other(anyhow::Error, String),
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/transparent-enum-many.stderr b/third_party/rust/thiserror/tests/ui/transparent-enum-many.stderr
new file mode 100644
index 0000000000..a9adfa5a90
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-enum-many.stderr
@@ -0,0 +1,6 @@
+error: #[error(transparent)] requires exactly one field
+ --> tests/ui/transparent-enum-many.rs:5:5
+ |
+5 | / #[error(transparent)]
+6 | | Other(anyhow::Error, String),
+ | |________________________________^
diff --git a/third_party/rust/thiserror/tests/ui/transparent-enum-not-error.rs b/third_party/rust/thiserror/tests/ui/transparent-enum-not-error.rs
new file mode 100644
index 0000000000..80ccfc973a
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-enum-not-error.stderr b/third_party/rust/thiserror/tests/ui/transparent-enum-not-error.stderr
new file mode 100644
index 0000000000..9be51434a6
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-enum-source.rs b/third_party/rust/thiserror/tests/ui/transparent-enum-source.rs
new file mode 100644
index 0000000000..3849f66e78
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-enum-source.rs
@@ -0,0 +1,9 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum Error {
+ #[error(transparent)]
+ Other(#[source] anyhow::Error),
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/transparent-enum-source.stderr b/third_party/rust/thiserror/tests/ui/transparent-enum-source.stderr
new file mode 100644
index 0000000000..ccb9067762
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-enum-source.stderr
@@ -0,0 +1,5 @@
+error: transparent variant can't contain #[source]
+ --> tests/ui/transparent-enum-source.rs:6:11
+ |
+6 | Other(#[source] anyhow::Error),
+ | ^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs b/third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.rs
new file mode 100644
index 0000000000..87c32e0b6c
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr b/third_party/rust/thiserror/tests/ui/transparent-enum-unnamed-field-not-error.stderr
new file mode 100644
index 0000000000..3d23c3a0e5
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-struct-many.rs b/third_party/rust/thiserror/tests/ui/transparent-struct-many.rs
new file mode 100644
index 0000000000..18f2466450
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-struct-many.rs
@@ -0,0 +1,10 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error(transparent)]
+pub struct Error {
+ inner: anyhow::Error,
+ what: String,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/transparent-struct-many.stderr b/third_party/rust/thiserror/tests/ui/transparent-struct-many.stderr
new file mode 100644
index 0000000000..c0e3806e7f
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-struct-many.stderr
@@ -0,0 +1,5 @@
+error: #[error(transparent)] requires exactly one field
+ --> tests/ui/transparent-struct-many.rs:4:1
+ |
+4 | #[error(transparent)]
+ | ^^^^^^^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/transparent-struct-not-error.rs b/third_party/rust/thiserror/tests/ui/transparent-struct-not-error.rs
new file mode 100644
index 0000000000..811ff53958
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-struct-not-error.stderr b/third_party/rust/thiserror/tests/ui/transparent-struct-not-error.stderr
new file mode 100644
index 0000000000..d67a694467
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-struct-source.rs b/third_party/rust/thiserror/tests/ui/transparent-struct-source.rs
new file mode 100644
index 0000000000..d4512c288b
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-struct-source.rs
@@ -0,0 +1,7 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[error(transparent)]
+pub struct Error(#[source] anyhow::Error);
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/transparent-struct-source.stderr b/third_party/rust/thiserror/tests/ui/transparent-struct-source.stderr
new file mode 100644
index 0000000000..3012ca3119
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/transparent-struct-source.stderr
@@ -0,0 +1,5 @@
+error: transparent error struct can't contain #[source]
+ --> tests/ui/transparent-struct-source.rs:5:18
+ |
+5 | pub struct Error(#[source] anyhow::Error);
+ | ^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs b/third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.rs
new file mode 100644
index 0000000000..b4f7fbbfd5
--- /dev/null
+++ b/third_party/rust/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/third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr b/third_party/rust/thiserror/tests/ui/transparent-struct-unnamed-field-not-error.stderr
new file mode 100644
index 0000000000..f715a15175
--- /dev/null
+++ b/third_party/rust/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<'_>`
diff --git a/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.rs b/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.rs
new file mode 100644
index 0000000000..7c439d941f
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.rs
@@ -0,0 +1,11 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+pub enum Error {
+ What {
+ #[error("...")]
+ io: std::io::Error,
+ },
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.stderr b/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.stderr
new file mode 100644
index 0000000000..bf3c24df29
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/unexpected-field-fmt.stderr
@@ -0,0 +1,5 @@
+error: not expected here; the #[error(...)] attribute belongs on top of a struct or an enum variant
+ --> tests/ui/unexpected-field-fmt.rs:6:9
+ |
+6 | #[error("...")]
+ | ^^^^^^^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/unexpected-struct-source.rs b/third_party/rust/thiserror/tests/ui/unexpected-struct-source.rs
new file mode 100644
index 0000000000..f39649424c
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/unexpected-struct-source.rs
@@ -0,0 +1,7 @@
+use thiserror::Error;
+
+#[derive(Error, Debug)]
+#[source]
+pub struct Error;
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/unexpected-struct-source.stderr b/third_party/rust/thiserror/tests/ui/unexpected-struct-source.stderr
new file mode 100644
index 0000000000..6f15841dc0
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/unexpected-struct-source.stderr
@@ -0,0 +1,5 @@
+error: not expected here; the #[source] attribute belongs on a specific field
+ --> tests/ui/unexpected-struct-source.rs:4:1
+ |
+4 | #[source]
+ | ^^^^^^^^^
diff --git a/third_party/rust/thiserror/tests/ui/union.rs b/third_party/rust/thiserror/tests/ui/union.rs
new file mode 100644
index 0000000000..cd6a9346d5
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/union.rs
@@ -0,0 +1,9 @@
+use thiserror::Error;
+
+#[derive(Error)]
+pub union U {
+ msg: &'static str,
+ num: usize,
+}
+
+fn main() {}
diff --git a/third_party/rust/thiserror/tests/ui/union.stderr b/third_party/rust/thiserror/tests/ui/union.stderr
new file mode 100644
index 0000000000..3ec4d71c0d
--- /dev/null
+++ b/third_party/rust/thiserror/tests/ui/union.stderr
@@ -0,0 +1,8 @@
+error: union as errors are not supported
+ --> tests/ui/union.rs:4:1
+ |
+4 | / pub union U {
+5 | | msg: &'static str,
+6 | | num: usize,
+7 | | }
+ | |_^