Skip to content

Incompatibility with bitflags 2.2 #87

@glueball

Description

@glueball

Trying to compile this crate with bitflags 2.2 gives a compilation error.

Minimal example:

Cargo.toml

[package]
name = "minimal-bitfields"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
mysql_common = "0.30.3"

main.rs

fn main() {
    println!("Hello, world!");
}

Compilation output:

error: recursion limit reached while expanding `__declare_bitflags!`
   --> C:\Users\jaumelopez\.cargo\registry\src\github.com-1ecc6299db9ec823\mysql_common-0.30.3\src\constants.rs:78:1
    |
78  | / my_bitflags! {
79  | |     CapabilityFlags,
80  | |     #[error("Unknown flags in the raw value of CapabilityFlags (raw={:b})", _0)]
81  | |     UnknownCapabilityFlags,
...   |
357 | |     }
358 | | }
    | |_^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mysql_common`)
    = note: this error originates in the macro `__declare_bitflags` which comes from the expansion of the macro `my_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)

"Pinning" bitflags to 2.1 fixes the compilation error.

"Fixed" Cargo.toml

[package]
name = "minimal-bitfields"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bitflags = "=2.1"
mysql_common = "0.30.3"

I'm uncertain if this is a bug in the upstream crate or in how mysql_common uses it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions