Skip to content

Compilation error with version 1.9.0 on g431 embedded target #129

@wolfjazz

Description

@wolfjazz

Hi,

I tried to update my dependencies to 1.9.0 (from 1.8.5), but I get a compilation error now when trying to build the package.

In my dependencies, I use

[dependencies]
critical-section = "1.2"  # critical section implementation
cortex-m = { version = "0.7", features = ["inline-asm", "critical-section-single-core"] }
cortex-m-interrupt = "0.2"  # interrupt handling
cortex-m-rt = { version = "0.7", features = ["zero-init-ram", "paint-stack"] }
hal = { package = "stm32-hal2", version = "~1.9", features = ["g431", "g4rt", "embedded_hal"] }

I am on Windows, use no_std in my project, and I am compiling with stable Rust. stm32-hal2 on 1.8.5 works fine, on 1.9.0 it doesn't.

I get the following compiler errors:

error[E0599]: the method `wait_for_idle` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:752:14
    |
752 |         self.wait_for_idle()?;
    |              ^^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `set_cr2_write` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:754:47
    |
754 |             i2c::Operation::Write(rb) => self.set_cr2_write(addr, rb.len(), false),
    |                                               ^^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `set_cr2_read` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:755:46
    |
755 |             i2c::Operation::Read(wb) => self.set_cr2_read(addr, wb.len(), false),
    |                                              ^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `write_bytes` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:759:47
    |
759 |             i2c::Operation::Write(rb) => self.write_bytes(rb),
    |                                               ^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `read_bytes` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:760:46
    |
760 |             i2c::Operation::Read(wb) => self.read_bytes(wb),
    |                                              ^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `wait_for_idle` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:767:26
    |
767 |                     self.wait_for_idle()?;
    |                          ^^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `set_cr2_write` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:768:26
    |
768 |                     self.set_cr2_write(addr, wb.len(), false);
    |                          ^^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `wait_for_idle` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:771:26
    |
771 |                     self.wait_for_idle()?;
    |                          ^^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `set_cr2_read` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:772:26
    |
772 |                     self.set_cr2_read(addr, rb.len(), false);
    |                          ^^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `write_bytes` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:779:51
    |
779 |                 i2c::Operation::Write(rb) => self.write_bytes(rb),
    |                                                   ^^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `read_bytes` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:780:50
    |
780 |                 i2c::Operation::Read(wb) => self.read_bytes(wb),
    |                                                  ^^^^^^^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

error[E0599]: the method `stop` exists for mutable reference `&mut I2c<R>`, but its trait bounds were not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:784:14
    |
784 |         self.stop();
    |              ^^^^ method cannot be called on `&mut I2c<R>` due to unsatisfied trait bounds
    |
note: trait bound `R: util::RccPeriph` was not satisfied
   --> C:\Users\mosma\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\stm32-hal2-1.9.0\src\i2c.rs:366:51
    |
364 | impl<R> I2c<R>
    |         ------
365 | where
366 |     R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
    |                                                   ^^^^^^^^^ unsatisfied trait bound introduced here

For more information about this error, try `rustc --explain E0599`.
error: could not compile `stm32-hal2` (lib) due to 12 previous errors

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions