Skip to content

#[derive_more::Error] refers to std:: #261

Closed
@StackOverflowExcept1on

Description

@StackOverflowExcept1on

I did two simple libraries here: https://github.com/StackOverflowExcept1on/derive-more-issue/

Why doesn't the library provide impl core::error::Error for Error?

#![no_std]

#[derive(Debug, Eq, PartialEq, derive_more::Display, derive_more::Error)]
pub enum Error {
    #[display(fmt = "Unable to write result")]
    WriteResult,
}

pub type Result<T, E = Error> = core::result::Result<T, E>;

pub fn foo(a: i32, b: i32) -> Result<i32> {
    a.checked_add(b).ok_or_else(|| Error::WriteResult)
}
error[E0433]: failed to resolve: could not find `std` in the list of imported crates
 --> src/lib.rs:3:54
  |
3 | #[derive(Debug, Eq, PartialEq, derive_more::Display, derive_more::Error)]
  |                                                      ^^^^^^^^^^^^^^^^^^ could not find `std` in the list of imported crates

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions