Verified Solution

[rust-lang/rust] Unexpected "macro is ambiguous" error when macro imports are generated by a macro

Sponsored Content
### ROOT CAUSE The issue occurs because the generated code uses the same macro name (`assert_biteq`) for two different macros (the runtime one and the const one) that have the same pattern, causing ambiguity. The macro system sees two macros with identical patterns, leading to the "macro is ambiguous" error. ### CODE FIX Change the generated code to use a different name for the const macro to avoid ambiguity. Here's the fixed macro: ```rust macro_rules! float_test { ( name: $name:ident, test $test:block ) => { mod $name { use super::*; mod const_ { use super::*; use crate::assert_biteq_const as __assert_biteq_const; // Use a unique alias #[test] pub fn test() { const { __assert_biteq_const!(0, 0); } // Use the unique alias } } } } } ```
Deploy on DigitalOcean ($200 Credit)

Related Fixes

[rust-lang/rust] linking armv7-unknown-linux-ohos target, rust-lld: error: undefined symbol: rust_eh_personality
[StackOverflow/python] Can't Import win32gui and win32ui modules to my project on Python 3.8 32-bit
[rust-lang/rust] rust-1.89 build failure due to "Undefined symbols for architecture x86_64"