From dc6f99d0c9aa88b82e46f6ea2a816b4ce67b8c4e Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 24 May 2024 11:36:43 -0400 Subject: [PATCH 1/3] Remove redundant link target --- src/Snafu.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Snafu.md b/src/Snafu.md index b6eecdc..2432804 100644 --- a/src/Snafu.md +++ b/src/Snafu.md @@ -46,15 +46,15 @@ it is valid. Detailed information on each attribute is below. ### Context fields -| Option (inside `#[snafu(...)]`) | Description | -|---------------------------------|-----------------------------------------------------------------------------------------------------------| -| `source` | Marks a field as the source error (even if not called `source`) | -| `source(from(type, transform))` | As above, plus converting from `type` to the field type by calling `transform` | -| `source(false)` | Marks a field that is named `source` as a regular field | -| `backtrace` | Marks a field as backtrace (even if not called `backtrace`) | -| `backtrace(false)` | Marks a field that is named `backtrace` as a regular field | -| `implicit` | Marks a field as implicit (Type needs to implement [`GenerateImplicitData`](crate::GenerateImplicitData)) | -| `provide` | Marks a field as providing a reference to the type | +| Option (inside `#[snafu(...)]`) | Description | +|---------------------------------|--------------------------------------------------------------------------------| +| `source` | Marks a field as the source error (even if not called `source`) | +| `source(from(type, transform))` | As above, plus converting from `type` to the field type by calling `transform` | +| `source(false)` | Marks a field that is named `source` as a regular field | +| `backtrace` | Marks a field as backtrace (even if not called `backtrace`) | +| `backtrace(false)` | Marks a field that is named `backtrace` as a regular field | +| `implicit` | Marks a field as implicit (Type needs to implement [`GenerateImplicitData`][]) | +| `provide` | Marks a field as providing a reference to the type | ## Controlling `Display` From b77d09796ea2f8fdd643424193c9eee0a37971c3 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 24 May 2024 11:41:59 -0400 Subject: [PATCH 2/3] Mark more test types as deliberately unused See also 7c704689fb4a96180b915f53733c149f9ce6a38d. --- compatibility-tests/renamed-import/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compatibility-tests/renamed-import/src/lib.rs b/compatibility-tests/renamed-import/src/lib.rs index 51fcb52..d256b33 100644 --- a/compatibility-tests/renamed-import/src/lib.rs +++ b/compatibility-tests/renamed-import/src/lib.rs @@ -5,8 +5,8 @@ use a_rose::{Backtrace, Snafu}; #[derive(Debug, Snafu)] #[snafu(crate_root(a_rose))] enum EnumError { - Leaf { username: String }, - WithBacktrace { backtrace: Backtrace }, + _Leaf { username: String }, + _WithBacktrace { backtrace: Backtrace }, } #[derive(Debug, Snafu)] From 26b82046b1f107c6d0ec22f5869a2a402e9fa621 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 24 May 2024 11:48:21 -0400 Subject: [PATCH 3/3] Add extra errors --- .../compile-fail/tests/ui/report.stderr | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/compatibility-tests/compile-fail/tests/ui/report.stderr b/compatibility-tests/compile-fail/tests/ui/report.stderr index 2f30c4b..eb9a0eb 100644 --- a/compatibility-tests/compile-fail/tests/ui/report.stderr +++ b/compatibility-tests/compile-fail/tests/ui/report.stderr @@ -21,3 +21,23 @@ error[E0277]: the trait bound `ExitCode: __InternalExtractErrorType` is not sati | = help: the trait `__InternalExtractErrorType` is implemented for `Result` = note: this error originates in the attribute macro `snafu::report` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `snafu::Report<_>: From<()>` is not satisfied + --> tests/ui/report.rs:6:1 + | +6 | #[snafu::report] + | ^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `snafu::Report<_>` + | + = help: the trait `From>` is implemented for `snafu::Report<_>` + = help: for that trait implementation, expected `Result<(), _>`, found `()` + = note: this error originates in the attribute macro `snafu::report` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `snafu::Report<_>: From` is not satisfied + --> tests/ui/report.rs:9:1 + | +9 | #[snafu::report] + | ^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `snafu::Report<_>` + | + = help: the trait `From>` is implemented for `snafu::Report<_>` + = help: for that trait implementation, expected `Result<(), _>`, found `ExitCode` + = note: this error originates in the attribute macro `snafu::report` (in Nightly builds, run with -Z macro-backtrace for more info)