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

Warn when two crates with different versions are in use in the same compilation unit #102882

Closed
pwnorbitals opened this issue Oct 10, 2022 · 4 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-crate-version-mismatch Diagnostics: Errors or lints caused be the use of two different crate versions. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pwnorbitals
Copy link

pwnorbitals commented Oct 10, 2022

I was faced with this error message, saying my Memory trait was both not implemented and implemented by the Flash type :

image

This particular issue was caused by having two different versions of the STM32H7 HAL, leading to this confusing and misleading error.

Should we consider adding a warning when two different versions of the same crate are in use in a single compilation unit ?

@pwnorbitals pwnorbitals added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 10, 2022
@mejrs
Copy link
Contributor

mejrs commented Oct 10, 2022

Can you post the full error (from cargo check)? This looks like ide output.

@memoryruins
Copy link
Contributor

Looks like a duplicate of #22750 and/or #89143

@pwnorbitals
Copy link
Author

pwnorbitals commented Oct 11, 2022

E:\Chris\GNCC\flight_software\GNCC_bootloader_l1>cargo check

    Compiling libcsp-freertos v0.1.0 ([hidden])
    Checking gncc-drivers v0.1.0 ([hidden])
    Checking gncc-config v0.1.0 ([hidden])
    Checking gncc_bootloader_l1 v0.1.0 ([hidden])
error[E0277]: the trait bound `Flash: Memory` is not satisfied
   --> src\main.rs:252:19
    |
252 |     active_image: SoftwareImage<Flash>,
    |                   ^^^^^^^^^^^^^^^^^^^^ the trait `Memory` is not implemented for `Flash`
    |
    = help: the following other types implement trait `Memory`:
              CY15B104Q<SPI, CS, SPIE, CSE>
              gncc_drivers::memory::nor_flash::NorFlash
              stm32h7xx_hal::flash::Flash
note: required by a bound in `SoftwareImage`
   --> [hidden]/software_image.rs:9:31
    |
9   | pub struct SoftwareImage<MEM: super::Memory> {
    |                               ^^^^^^^^^^^^^ required by this bound in `SoftwareImage`
For more information about this error, try `rustc --explain E0277`.
 
error: could not compile `gncc_bootloader_l1` due to previous error

@estebank
Copy link
Contributor

estebank commented Aug 8, 2024

I believe this is fixed by #124944. Without a repro I can't confirm. If this comes up again, please reopen this ticket or open a new one.

@estebank estebank closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-crate-version-mismatch Diagnostics: Errors or lints caused be the use of two different crate versions. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants