Skip to content

Using #[from] #[backtrace] fails to compile #282

@segevfiner

Description

@segevfiner
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
    #[error("system: {0}")]
    System(#[from] #[backtrace] anyhow::Error),
}
Error
⣿
Errors

Exited with status 101

Standard Error

   Compiling playground v0.0.1 (/playground)
error[[E0432]](https://doc.rust-lang.org/stable/error_codes/E0432.html): unresolved import `thiserror`
   --> src/lib.rs:3:10
    |
3   | #[derive(Error, Debug)]
    |          ^^^^^ no `ThiserrorProvide` in `__private`
    |
note: found an item that was configured out
   --> /playground/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.53/src/lib.rs:256:29
    |
256 |     pub use crate::provide::ThiserrorProvide;
    |                             ^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[[E0658]](https://doc.rust-lang.org/stable/error_codes/E0658.html): use of unstable library feature 'error_generic_member_access'
 --> src/lib.rs:3:10
  |
3 | #[derive(Error, Debug)]
  |          ^^^^^
  |
  = note: [see issue #99301 <https://github.com/rust-lang/rust/issues/99301>](https://github.com/rust-lang/rust/issues/99301) for more information
  = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[[E0599]](https://doc.rust-lang.org/stable/error_codes/E0599.html): no method named `thiserror_provide` found for reference `&anyhow::Error` in the current scope
 --> src/lib.rs:5:13
  |
5 |     #[error("system: {0}")]
  |             ^^^^^^^^^^^^^ method not found in `&Error`

Some errors have detailed explanations: E0432, E0599, E0658.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `playground` (lib) due to 3 previous errors

Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions