Antti / rust-amq-proto

AMQP Protocol implementation in Rust
9 stars 2 forks source link

Got error[E0227] when compile amq-proto #2

Open Qinka opened 5 years ago

Qinka commented 5 years ago

I got an error(E0227).

error[E0277]: the trait bound `error::Error: std::convert::From<std::io::Error>` is not satisfied
   --> C:\Users\qinka\.cargo\registry\src\mirrors.ustc.edu.cn-61ef6e0cd06fb9b8\amq-proto-0.1.0\src\codegen_macros.rs:148:23
    |
148 |             let res = self.data.write_all(&self.bits.to_bytes()).map_err(From::from);
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::io::Error>` is not implemented for `error::Error`
    |
    = help: the following implementations were found:
              <error::Error as std::convert::From<&'a str>>
              <error::Error as std::convert::From<error::ErrorKind>>
              <error::Error as std::convert::From<std::string::String>>
    = note: required by `std::convert::From::from`

The version of Rust compiler is

rustc 1.34.0-nightly (3315728c0 2019-02-09)
atoav commented 5 years ago

I get the same error with 1.33, but for me it looks more like this (scroll to line 359 to see it starting): https://ci.appveyor.com/project/atoav/bender-worker/build/job/de75trbhis6tjpvc

I want to add, that this seems to only happen on windows targets, not on unix targets. It would be quite cool if this could be somehow resolved..

atoav commented 5 years ago

I could reproduce this error locally on a Windows system by cloning this reprository and running cargo build. Weirdly enough it builds perfectly fine on unix based systems. On Windows it fails with:

error: Could not compile `amq-proto`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to 108 previous errors 

I checked and it seems that all these 108 Errors seem to be related to Error handling, many of them obviously caused by another. Except for two errors in src/framing.rs all other errors happen in src/table.rs and src/codegen_macros.rs. I am not at all familiar with macros in Rust, but I suspect the Macros are the root cause?

I am working on a cross plattform project that uses rust-amqp. This seems to be the onlyt remaining issue that stops a Windows build for me, it would be extremely cool if this would be resolved.

Qinka commented 5 years ago

@atoav , I used lapin instead.

atoav commented 5 years ago

@atoav , I used lapin instead.

Thanks for the suggestion, but I'd like to avoid it, because my application relies in many places on the rust-amqp Channel, and it would be a kinda length operation, that I am not really prepared to go through right now..

tyrylu commented 5 years ago

Same there, i wanted to use amqp, because lapin is behaving somewhat weirdly with async/await, mainly the consumption, so i wanted to try something without futures...

Qinka commented 5 years ago

@tyrylu Believe me. You can find a way out with lapin, even it's weird. However, the only way you can find in this repo is named "no way".

tyrylu commented 5 years ago

Yeah, it seems so. But i have a weird lapin_futures issue as well, see https://github.com/sozu-proxy/lapin/issues/165

zhendexuebuhui commented 3 years ago

I also encountered this problem

StyMaar commented 2 years ago

This error happens because error chain (or at least version 0.10) only implement the conversion needed conversion for Unix platforms:

    #[cfg(unix)]
    impl From<::std::io::Error> for Error {
        fn from(e: ::std::io::Error) -> Self {
            Error::from_kind(ErrorKind::Io(e))
        }
    }

(This is the output of cargo-expand for the error module of this crate). That's pretty unfortunate, but I guess everybody already moved away from this library so I must be the last person affected…

keyurnpatel commented 2 years ago

encountered same issue.