embassy-rs / embedded-io

MOVED TO https://github.com/rust-embedded/embedded-hal
Apache License 2.0
21 stars 13 forks source link

compilation fails for asynch.rs #7

Closed vortex314 closed 2 years ago

vortex314 commented 2 years ago

Any idea what could be the cause of these compilation errors ?

error[E0658]: generic associated types are unstable
  --> /home/lieven/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-io-0.3.1/src/asynch.rs:17:5
   |
17 | /     type ReadFuture<'a>: Future<Output = Result<usize, Self::Error>>
18 | |     where
19 | |         Self: 'a;
   | |_________________^
   |
   = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
   = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable

error[E0658]: where clauses on associated types are unstable
  --> /home/lieven/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-io-0.3.1/src/asynch.rs:17:5
   |
17 | /     type ReadFuture<'a>: Future<Output = Result<usize, Self::Error>>
18 | |     where
19 | |         Self: 'a;
   | |_________________^
   |
   = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
   = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable

error[E0658]: generic associated types are unstable
  --> /home/lieven/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-io-0.3.1/src/asynch.rs:48:5
   |
48 | /     type FillBufFuture<'a>: Future<Output = Result<&'a [u8], Self::Error>>
49 | |     where
50 | |         Self: 'a;
   | |_________________^
   |
   = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
   = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable

error[E0658]: where clauses on associated types are unstable
  --> /home/lieven/.cargo/registry/src/github.com-1ecc6299db9ec823/embedded-io-0.3.1/src/asynch.rs:48:5
   |
48 | /     type FillBufFuture<'a>: Future<Output = Result<&'a [u8], Self::Error>>
49 | |     where
50 | |         Self: 'a;
   | |_________________^
   |
   = note: see issue #44265 <https://github.com/rust-lang/rust/issues/44265> for more information
   = help: add `#![feature(generic_associated_types)]` to the crate attributes to enable
.....
Dirbaio commented 2 years ago

You're using a too old nightly, make sure to use this one:

https://github.com/embassy-rs/embedded-io/blob/68d523621bd56eab62c38b6a402187a3341bc45c/rust-toolchain.toml#L2

vortex314 commented 2 years ago

Thanks for the swift response. looks like target xtensa-esp32-espidf enforces a bad combination of crates and rust compiler. I'm still a newbie on rust, these incompatibilities makes it difficult to get started.

fermuch commented 2 years ago

@vortex314 hey, new here too 😃 How did you solve it?

vortex314 commented 2 years ago

@fermuch i didn't. it looks like the version 0.3.1 contains some changes that are breaking compared to 0.3.0. espressif rust is using embedded-svc that requires embedded-io 0.3 and takes by default 0.3.1, which probably worked fine with 0.3.0. this is based on my basic understanding of the dependency tree in esp-std-demo , so i could be mistaken. the esp32 target probably uses an older version of the compiler than required by this crate.

i don't have enough experience to correct this dependency. so i signalled this also to espressif github. https://github.com/ivmarkov/rust-esp32-std-demo/issues/123