Skip to content

bitflags v2.2 incompatibility with mysql_common #343

@glueball

Description

@glueball

Originally posted on mysql_common repo (blackbeam/rust_mysql_common#87), but the maintainer there seems to think this is an issue with bitflags, so just letting you know. I don't know whether this is a bug on bitflags itself or on how mysql_common uses it, but at the very least might be a compatibility break on 2.2.

Trying to compile the last version of the mysql_common 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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions