2.12.0 causes build failure while trying to compile dispatch2 on macOS #486

Closed
opened 2026-05-29 08:22:55 -05:00 by tronical · 6 comments
tronical commented 2026-05-29 08:22:55 -05:00 (Migrated from github.com)

Steps to reproduce

git clone https://github.com/femtovg/femtovg
cd femtovg
cargo build --all-features --features glutin/wayland,glutin/egl

yields:

error: recursion limit reached while expanding `$crate::__bitflags_flag_name!`
    --> /Users/simon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dispatch2-0.3.1/src/generated/mod.rs:1601:1
     |
1601 | / bitflags::bitflags! {
1602 | |     impl dispatch_block_flags_t: c_ulong {
1603 | | /// Flags to pass to the dispatch_block_create* functions.
1604 | | ///
...    |
1976 | | }
     | |_^
     |
     = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`dispatch2`)
     = note: this error originates in the macro `$crate::__bitflags_flag_name` which comes from the expansion of the macro `bitflags::bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `dispatch2` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

It compiles with version 2.11.1.

Steps to reproduce ``` git clone https://github.com/femtovg/femtovg cd femtovg cargo build --all-features --features glutin/wayland,glutin/egl ``` yields: ``` error: recursion limit reached while expanding `$crate::__bitflags_flag_name!` --> /Users/simon/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/dispatch2-0.3.1/src/generated/mod.rs:1601:1 | 1601 | / bitflags::bitflags! { 1602 | | impl dispatch_block_flags_t: c_ulong { 1603 | | /// Flags to pass to the dispatch_block_create* functions. 1604 | | /// ... | 1976 | | } | |_^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`dispatch2`) = note: this error originates in the macro `$crate::__bitflags_flag_name` which comes from the expansion of the macro `bitflags::bitflags` (in Nightly builds, run with -Z macro-backtrace for more info) error: could not compile `dispatch2` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... ``` It compiles with version 2.11.1.
KodrAus commented 2026-05-29 09:13:59 -05:00 (Migrated from github.com)

@tronical Ah I was worried about that. The macros are very sensitive to depth. Does it successfully compile if you do increase the default recursion limit?

@tronical Ah I was worried about that. The macros are very sensitive to depth. Does it successfully compile if you do increase the default recursion limit?
tronical commented 2026-05-29 09:16:41 -05:00 (Migrated from github.com)

Yes, it compiles if I add #![recursion_limit = "256"] to dispatch2's lib.rs.

Yes, it compiles if I add `#![recursion_limit = "256"]` to `dispatch2`'s `lib.rs`.
KodrAus commented 2026-05-29 09:23:03 -05:00 (Migrated from github.com)

I suspect that library was probably already close to the recursion limit. I’m going to yank this release and revert the #[flag_name] feature. I don’t think we can reasonably do any additional macro processing without risking breaking these kinds of users.

I suspect that library was probably already close to the recursion limit. I’m going to yank this release and revert the `#[flag_name]` feature. I don’t think we can reasonably do any additional macro processing without risking breaking these kinds of users.
tronical commented 2026-05-29 09:27:03 -05:00 (Migrated from github.com)

Sorry about that :). And thanks a lot for the quick response! ❤️

Sorry about that :). And thanks a lot for the quick response! ❤️
KodrAus commented 2026-05-29 09:28:00 -05:00 (Migrated from github.com)

Ok this has been yanked now. Thanks for the report @tronical! I'll leave this open for a bit in case anyone else has hit this issue in the meantime.

Ok this has been yanked now. Thanks for the report @tronical! I'll leave this open for a bit in case anyone else has hit this issue in the meantime.
KodrAus commented 2026-05-31 15:28:57 -05:00 (Migrated from github.com)

I've found a way to make this work without needing to revert the flag-renaming feature so will re-stabilize as 2.12.1. I've included the original declaration from dispatch2 as a test case to try catch future recursion limit regressions from attributes.

I've found a way to make this work without needing to revert the flag-renaming feature so will re-stabilize as `2.12.1`. I've included the original declaration from `dispatch2` as a test case to try catch future recursion limit regressions from attributes.
Sign in to join this conversation.
No labels
bug
good first issue
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-bitflags/bitflags#486
No description provided.