-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ui tests with compile_error resolved at call site
- Loading branch information
Showing
18 changed files
with
88 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: #[error(transparent)] needs to go outside the enum or struct, not on an individual field | ||
--> tests/ui/bad-field-attr.rs:5:18 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error(transparent)] | ||
5 | pub struct Error(#[error(transparent)] std::io::Error); | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: duplicate #[source] attribute | ||
--> tests/ui/duplicate-enum-source.rs:8:9 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
8 | #[source] | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: only one #[error(...)] attribute is allowed | ||
--> tests/ui/duplicate-fmt.rs:5:1 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error("...")] | ||
5 | #[error("...")] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: duplicate #[source] attribute | ||
--> tests/ui/duplicate-struct-source.rs:7:5 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
7 | #[source] | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: duplicate #[error(transparent)] attribute | ||
--> tests/ui/duplicate-transparent.rs:5:1 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error(transparent)] | ||
5 | #[error(transparent)] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: deriving From requires no fields other than source and backtrace | ||
--> tests/ui/from-backtrace-backtrace.rs:8:18 | ||
| | ||
6 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
7 | #[error("...")] | ||
8 | pub struct Error(#[from] #[backtrace] std::io::Error, Backtrace); | ||
| ^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: #[from] is only supported on the source field, not any other field | ||
--> tests/ui/from-not-source.rs:7:5 | ||
| | ||
3 | #[derive(Debug, Error)] | ||
| ----- in this derive macro expansion | ||
... | ||
7 | #[from] | ||
| ^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
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 | ||
| | ||
4 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
5 | #[error("error")] | ||
6 | struct Error<'a>(#[from] Inner<'a>); | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
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 | ||
| | ||
12 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
15 | Foo(#[from] Generic<&'a str>), | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: missing #[error("...")] display attribute | ||
--> tests/ui/missing-fmt.rs:7:5 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
7 | B(usize), | ||
| ^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: cannot have both #[error(transparent)] and a display attribute | ||
--> tests/ui/transparent-display.rs:5:1 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error(transparent)] | ||
5 | #[error("...")] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
error: #[error(transparent)] requires exactly one field | ||
--> tests/ui/transparent-enum-many.rs:5:5 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | pub enum Error { | ||
5 | / #[error(transparent)] | ||
6 | | Other(anyhow::Error, String), | ||
| |________________________________^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: transparent variant can't contain #[source] | ||
--> tests/ui/transparent-enum-source.rs:6:11 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
6 | Other(#[source] anyhow::Error), | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
error: #[error(transparent)] requires exactly one field | ||
--> tests/ui/transparent-struct-many.rs:4:1 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error(transparent)] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
error: transparent error struct can't contain #[source] | ||
--> tests/ui/transparent-struct-source.rs:5:18 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[error(transparent)] | ||
5 | pub struct Error(#[source] anyhow::Error); | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
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 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
... | ||
6 | #[error("...")] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
error: not expected here; the #[source] attribute belongs on a specific field | ||
--> tests/ui/unexpected-struct-source.rs:4:1 | ||
| | ||
3 | #[derive(Error, Debug)] | ||
| ----- in this derive macro expansion | ||
4 | #[source] | ||
| ^^^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
error: union as errors are not supported | ||
--> tests/ui/union.rs:4:1 | ||
| | ||
3 | #[derive(Error)] | ||
| ----- in this derive macro expansion | ||
4 | / pub union U { | ||
5 | | msg: &'static str, | ||
6 | | num: usize, | ||
7 | | } | ||
| |_^ | ||
| | ||
= note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info) |