rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
315 stars 70 forks source link

ssd 1306 does not compile because of maybe-async-cfg 0.2.5 #219

Open kelko opened 2 weeks ago

kelko commented 2 weeks ago

Description of the problem/feature request/other

I have a running local project with ssd1306 crate in version 0.9.0. It all worked fine, until today I wanted a second project with basically the same setup. In the second project the ssd1306 crate just wouldn't compile:

~/Developer/Nova-Vergleich/Embedded/sp2040-playground git:[pagr]
cargo build
   Compiling pio-parser v0.2.2
   Compiling ssd1306 v0.9.0
error[E0277]: `Result<(), DisplayError>` is not a future
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:87:56
   |
87 | ... false).send(iface).await
   |                       -^^^^^
   |                       ||
   |                       |`Result<(), DisplayError>` is not a future
   |                       help: remove the `.await`
   |
   = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
   = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
   = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:105:57
    |
105 | ... false).send(iface).await
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:123:57
    |
123 | ... false).send(iface).await
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:143:56
    |
143 | ... false).send(iface).await?;
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:144:55
    |
144 | ..., true).send(iface).await
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:164:56
    |
164 | ... false).send(iface).await
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0277]: `Result<(), DisplayError>` is not a future
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:184:56
    |
184 | ... false).send(iface).await
    |                       -^^^^^
    |                       ||
    |                       |`Result<(), DisplayError>` is not a future
    |                       help: remove the `.await`
    |
    = help: the trait `Future` is not implemented for `Result<(), DisplayError>`, which is required by `Result<(), DisplayError>: IntoFuture`
    = note: Result<(), DisplayError> must be a future or must implement `IntoFuture` to be awaited
    = note: required for `Result<(), DisplayError>` to implement `IntoFuture`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `size::DisplaySize128x64`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:77:1
   |
77 | impl DisplaySize for DisplaySize128x64 {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | first implementation here
   | conflicting implementation for `size::DisplaySize128x64`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `size::DisplaySize128x32`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:95:1
   |
95 | impl DisplaySize for DisplaySize128x32 {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | first implementation here
   | conflicting implementation for `size::DisplaySize128x32`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `size::DisplaySize96x16`
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:113:1
    |
113 | impl DisplaySize for DisplaySize96x16 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |
    | first implementation here
    | conflicting implementation for `size::DisplaySize96x16`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `size::DisplaySize72x40`
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:131:1
    |
131 | impl DisplaySize for DisplaySize72x40 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |
    | first implementation here
    | conflicting implementation for `size::DisplaySize72x40`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `size::DisplaySize64x48`
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:152:1
    |
152 | impl DisplaySize for DisplaySize64x48 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |
    | first implementation here
    | conflicting implementation for `size::DisplaySize64x48`

error[E0119]: conflicting implementations of trait `size::DisplaySize` for type `DisplaySize64x32`
   --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:172:1
    |
172 | impl DisplaySize for DisplaySize64x32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |
    | first implementation here
    | conflicting implementation for `DisplaySize64x32`

error[E0277]: the trait bound `size::DisplaySize128x64: DisplaySizeAsync` is not satisfied
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:36:30
   |
36 | impl TerminalDisplaySize for DisplaySize128x64 {
   |                              ^^^^^^^^^^^^^^^^^ the trait `DisplaySizeAsync` is not implemented for `size::DisplaySize128x64`
   |
help: this trait has no implementations, consider adding one
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:33:1
   |
33 | pub trait DisplaySize {
   | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TerminalDisplaySizeAsync`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:23:32
   |
23 | pub trait TerminalDisplaySize: DisplaySize {
   |                                ^^^^^^^^^^^ required by this bound in `TerminalDisplaySizeAsync`

error[E0277]: the trait bound `size::DisplaySize128x32: DisplaySizeAsync` is not satisfied
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:48:30
   |
48 | impl TerminalDisplaySize for DisplaySize128x32 {
   |                              ^^^^^^^^^^^^^^^^^ the trait `DisplaySizeAsync` is not implemented for `size::DisplaySize128x32`
   |
help: this trait has no implementations, consider adding one
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:33:1
   |
33 | pub trait DisplaySize {
   | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TerminalDisplaySizeAsync`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:23:32
   |
23 | pub trait TerminalDisplaySize: DisplaySize {
   |                                ^^^^^^^^^^^ required by this bound in `TerminalDisplaySizeAsync`

error[E0277]: the trait bound `size::DisplaySize96x16: DisplaySizeAsync` is not satisfied
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:60:30
   |
60 | impl TerminalDisplaySize for DisplaySize96x16 {
   |                              ^^^^^^^^^^^^^^^^ the trait `DisplaySizeAsync` is not implemented for `size::DisplaySize96x16`
   |
help: this trait has no implementations, consider adding one
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:33:1
   |
33 | pub trait DisplaySize {
   | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TerminalDisplaySizeAsync`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:23:32
   |
23 | pub trait TerminalDisplaySize: DisplaySize {
   |                                ^^^^^^^^^^^ required by this bound in `TerminalDisplaySizeAsync`

error[E0277]: the trait bound `size::DisplaySize72x40: DisplaySizeAsync` is not satisfied
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:72:30
   |
72 | impl TerminalDisplaySize for DisplaySize72x40 {
   |                              ^^^^^^^^^^^^^^^^ the trait `DisplaySizeAsync` is not implemented for `size::DisplaySize72x40`
   |
help: this trait has no implementations, consider adding one
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:33:1
   |
33 | pub trait DisplaySize {
   | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TerminalDisplaySizeAsync`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:23:32
   |
23 | pub trait TerminalDisplaySize: DisplaySize {
   |                                ^^^^^^^^^^^ required by this bound in `TerminalDisplaySizeAsync`

error[E0277]: the trait bound `size::DisplaySize64x48: DisplaySizeAsync` is not satisfied
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:84:30
   |
84 | impl TerminalDisplaySize for DisplaySize64x48 {
   |                              ^^^^^^^^^^^^^^^^ the trait `DisplaySizeAsync` is not implemented for `size::DisplaySize64x48`
   |
help: this trait has no implementations, consider adding one
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/size.rs:33:1
   |
33 | pub trait DisplaySize {
   | ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `TerminalDisplaySizeAsync`
  --> /CENSORED/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ssd1306-0.9.0/src/mode/terminal.rs:23:32
   |
23 | pub trait TerminalDisplaySize: DisplaySize {
   |                                ^^^^^^^^^^^ required by this bound in `TerminalDisplaySizeAsync`

Some errors have detailed explanations: E0119, E0277.
For more information about an error, try `rustc --explain E0119`.
error: could not compile `ssd1306` (lib) due to 18 previous errors
warning: build failed, waiting for other jobs to finish...

My tests indicate, that the culprit is the update of maybe-async-cfg from 0.2.4 (in the first project) to 0.2.5 (in the second project), as the following diff on the cargo.lock makes the difference between compiling and failing:

:100644 100644 8decaec 0000000 M    Cargo.lock

diff --git a/Cargo.lock b/Cargo.lock
index 8decaec..b04de4a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -948,13 +948,37 @@ version = "0.4.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"

+[[package]]
+name = "manyhow"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b33efb3ca6d3b07393750d4030418d594ab1139cee518f0dc88db70fec873587"
+dependencies = [
+ "manyhow-macros",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "syn 2.0.85",
+]
+
+[[package]]
+name = "manyhow-macros"
+version = "0.11.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46fce34d199b78b6e6073abf984c9cf5fd3e9330145a93ee0738a7443e371495"
+dependencies = [
+ "proc-macro-utils",
+ "proc-macro2",
+ "quote",
+]
+
 [[package]]
 name = "maybe-async-cfg"
-version = "0.2.4"
+version = "0.2.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1e083394889336bc66a4eaf1011ffbfa74893e910f902a9f271fa624c61e1b2"
+checksum = "8dbfaa67a76e2623580df07d6bb5e7956c0a4bae4b418314083a9c619bd66627"
 dependencies = [
- "proc-macro-error",
+ "manyhow",
  "proc-macro2",
  "pulldown-cmark",
  "quote",
@@ -1178,6 +1202,17 @@ dependencies = [
  "version_check",
 ]

+[[package]]
+name = "proc-macro-utils"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eeaf08a13de400bc215877b5bdc088f241b12eb42f0a548d3390dc1c56bb7071"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "smallvec",
+]
+
 [[package]]
 name = "proc-macro2"
 version = "1.0.89"
Dicklessgreat commented 12 hours ago

I had the same issue, and solved this problem by:

[patch.crates-io]
ssd1306 = { git = "https://github.com/rust-embedded-community/ssd1306.git", rev = "f3a2f7aca421fbf3ddda45ecef0dfd1f0f12330e" }

at Cargo.toml see also https://github.com/rust-embedded-community/ssd1306/pull/218