rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
682 stars 149 forks source link

While compiling got error[E0659]: `core` is ambiguous --> missing self:: when reexporting modules #657

Closed pellico closed 1 year ago

pellico commented 1 year ago

Peripheral could have names that conflict with crates names.

How to reproduce:

Error

error[E0659]: `core` is ambiguous
     --> src\lib.rs:73622:13
      |
73622 |     pub use core::CORE;
      |             ^^^^ ambiguous name
      |
      = note: ambiguous because of multiple potential import sources
      = note: `core` could refer to a built-in crate
      = help: use `::core` to refer to this crate unambiguously
note: `core` could also refer to the module defined here
     --> src\lib.rs:73625:5
      |
73625 | /     pub mod core {
73626 | |         #[doc = r"Register block"]
73627 | |         #[repr(C)]
73628 | |         pub struct CORE {
...     |
81671 | |         }
81672 | |     }
      | |_____^
      = help: use `self::core` to refer to this module unambiguously

For more information about this error, try `rustc --explain E0659`.
error: could not compile `cyt3bb` due to previous error

Workaround

Replace manually pub use core::CORE; with pub use self::core::CORE;