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

Make use of const generics (take 2) #227

Merged
merged 2 commits into from
May 25, 2021
Merged

Conversation

Piroro-hs
Copy link
Contributor

@Piroro-hs Piroro-hs commented May 25, 2021

Closes #224

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented May 25, 2021

This is much better 🎉 thank you :)

error[E0599]: the method `into_af7_push_pull` exists for struct `stm32f3xx_hal::gpio::Pin<Gpiob, U<9_u8>, Input>
`, but its trait bounds were not satisfied
   --> testsuite/tests/uart.rs:65:18
    |
65  |                 .into_af7_push_pull(&mut gpiob.moder, &mut gpiob.otyper, &mut gpiob.afrh),
    |                  ^^^^^^^^^^^^^^^^^^
    |
   ::: /home/fabian/Projects/stm32f3xx-hal/src/gpio.rs:272:1
    |
272 | pub struct Pin<Gpio, Index, Mode> {
    | --------------------------------- doesn't satisfy `_: IntoAf7`
    |
    = note: the following trait bounds were not satisfied:
            `stm32f3xx_hal::gpio::Pin<Gpiob, U<9_u8>, Input>: IntoAf7`

I find the error message still a bit leaky (leaking irrelevant implementation details of the gpio module), which is partially due to the type alias used. But I guess, we have to live with it, as it is not easily solvable without sacrificing flexibility in the generic implementation. Maybe the error message will improve with later rustc versions 😁

@Sh3Rm4n Sh3Rm4n merged commit dac205e into stm32-rs:master May 25, 2021
@Piroro-hs Piroro-hs deleted the untypenum branch May 27, 2021 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants