David-OConnor / stm32-hal

This library provides access to STM32 peripherals in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`rcc_en_reset` doesn't work when `paste` is not imported

kellda opened this issue · comments

When using the rcc_en_reset macro, I get errors that paste and cfg-if are not found. Adding them to Cargo.toml fixes the errors, but it should not be needed.

A solution would be to re-export the paste and cfg_if macros (maybe with #[doc(hidden)]) and use ::stm32_hal2::paste and ::stm32_hal2::cfg_if instead.

Could you give an example of context? rcc_en_reset is intended for internal use only.

So maybe I didn't understood how to use it. I thought I had to enable each peripheral with this macro before to use it.

Nope - that's handled in the constructors, which call rcc_en_reset. I think this confusion was caused by Rust's non-standard export mechanics of macros compared to normal fns and structs.

FWIW, I tried removing the #[macro_export] line above that macro just now so it's not exposed publicly, but it stopped working privately when I did.

I'm reclassifying this as a [fixed] bug. Switched to a diff syntax instead of #[macro_export], and it's now pub(crate) visibility.

Good find!