New Debug impl fails to compile when the bitflags are conditional #8

Closed
opened 2015-06-01 15:04:23 -05:00 by CraZySacX · 1 comment
CraZySacX commented 2015-06-01 15:04:23 -05:00 (Migrated from github.com)

The following code cause a compilation error when compiled not compiled with feature "C".

bitflags! {
    flags Flags: u32 {
        const FLAG_A = 0b00000001,
        const FLAG_B  = 0b00000010,
        #[cfg(feature = "C")] const FLAG_C = 0b00000100,
    }
}

:12:22: 12:28 error: unresolved name FLAG_C
:12 if self . contains ( $ Flag ) {
^~~~~~
:1:1: 79:67 note: in expansion of bitflags!
:77:1: 79:63 note: expansion site
:1:1: 79:67 note: in expansion of bitflags!

The following code cause a compilation error when compiled not compiled with feature "C". ``` rust bitflags! { flags Flags: u32 { const FLAG_A = 0b00000001, const FLAG_B = 0b00000010, #[cfg(feature = "C")] const FLAG_C = 0b00000100, } } ``` > <bitflags macros>:12:22: 12:28 error: unresolved name `FLAG_C` > <bitflags macros>:12 if self . contains ( $ Flag ) { > ^~~~~~ > <bitflags macros>:1:1: 79:67 note: in expansion of bitflags! > <bitflags macros>:77:1: 79:63 note: expansion site > <bitflags macros>:1:1: 79:67 note: in expansion of bitflags!
alexcrichton commented 2015-06-01 15:38:48 -05:00 (Migrated from github.com)

Fixed in #9

Fixed in #9
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#8
No description provided.