Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions compatibility-tests/compile-fail/tests/ui/report.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,23 @@ error[E0277]: the trait bound `ExitCode: __InternalExtractErrorType` is not sati
|
= help: the trait `__InternalExtractErrorType` is implemented for `Result<T, E>`
= 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<Result<(), _>>` 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<ExitCode>` is not satisfied
--> tests/ui/report.rs:9:1
|
9 | #[snafu::report]
| ^^^^^^^^^^^^^^^^ the trait `From<ExitCode>` is not implemented for `snafu::Report<_>`
|
= help: the trait `From<Result<(), _>>` 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)
4 changes: 2 additions & 2 deletions compatibility-tests/renamed-import/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
18 changes: 9 additions & 9 deletions src/Snafu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down