Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is std::error::Error not implemented for smoltcp::Error? #484

Closed
JakkuSakura opened this issue Jun 7, 2021 · 1 comment · Fixed by #485
Closed

Why is std::error::Error not implemented for smoltcp::Error? #484

JakkuSakura opened this issue Jun 7, 2021 · 1 comment · Fixed by #485

Comments

@JakkuSakura
Copy link
Contributor

I'm trying to use anyhow to catch all errors in a simple example. However,

error[E0277]: the trait bound `smoltcp::Error: std::error::Error` is not satisfied
   --> devourer/examples/dhcp_client.rs:110:41
    |
110 |         let x = tcp.recv_slice(&mut buf)?;
    |                                         ^ the trait `std::error::Error` is not implemented for `smoltcp::Error`
    |
    = note: required because of the requirements on the impl of `From<smoltcp::Error>` for `anyhow::Error`
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, smoltcp::Error>>` for `Result<(), anyhow::Error>`
    = note: required by `from_residual`

Is it because smoltcp::Error is oversimplied and discouraged to expose to external libraries? However, I see that smoltcp::Error is already Display+Debug, which std::error::Error only requires

@JakkuSakura JakkuSakura changed the title Why is std::error::Error not implemented for smoltcp::Error? Why is std::error::Error not implemented for smoltcp::Error? Jun 7, 2021
@Dirbaio
Copy link
Member

Dirbaio commented Jun 7, 2021

There's no particular reason it doesn't implement std::error::Error, it's probably just lack of demand since it can't be used in no-std code anyway. It could be implemented to be used in std-using code. PRs welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants