Skip to content

Crate can not deal with fully qualified paths for arbitrary_int #68

@robamu

Description

@robamu

When given a bitfield like this:

/// 1 MB section translation entry, mapping a 1 MB region to a physical address.
#[derive(Debug)]
#[bitbybit::bitfield(u32)]
pub struct L1Section {
    #[bits(20..=31, rw)]
    phys_base: arbitrary_int::u12,
    #[bit(16, rw)]
    ng: bool,
    #[bit(16, rw)]
    s: bool,
    #[bit(15, rw)]
    apx: bool,
    #[bits(12..=14, rw)]
    tex: arbitrary_int::u3,
    #[bits(10..=11, rw)]
    ap: arbitrary_int::u2,
    #[bit(9, rw)]
    p_bit: bool,
    #[bits(5..=8, rw)]
    domain: arbitrary_int::u4,
    #[bit(4, rw)]
    xn: bool,
    #[bit(3, rw)]
    c: bool,
    #[bit(2, rw)]
    b: bool,
    #[bits(0..=1, rw)]
    entry_type: L1EntryType,
}

the derive macro has issues with the fully qualified paths for the arbitrary_int paths. I have to use u3/u2, and import them explicitely. The error was also a bit confusing, because it mentioned the solution suggestions for exhaustive/non-exhaustive enums.

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