Function-local bitflags #71

Closed
opened 2017-03-07 11:34:28 -06:00 by dtolnay · 0 comments
dtolnay commented 2017-03-07 11:34:28 -06:00 (Migrated from github.com)

Is there any hope of supporting usage like this? The error here is inconsistent with being able to declare structs and other types of items local to a function.

#[macro_use]
extern crate bitflags;

fn main() {
    bitflags! {
        flags Flags: u8 {
            const A = 1,
            const B = 2,
        }
    }
    println!("{:?}", A);
}
error[E0425]: cannot find value `A` in module `super::super`
  --> src/main.rs:5:5
   |
5  |       bitflags! {
   |  _____^ starting here...
6  | |         flags Flags: u8 {
7  | |             const A = 1,
8  | |             const B = 2,
9  | |         }
10 | |     }
   | |_____^ ...ending here: not found in `super::super`
   |
   = note: this error originates in a macro outside of the current crate
Is there any hope of supporting usage like this? The error here is inconsistent with being able to declare structs and other types of items local to a function. ```rust #[macro_use] extern crate bitflags; fn main() { bitflags! { flags Flags: u8 { const A = 1, const B = 2, } } println!("{:?}", A); } ``` ``` error[E0425]: cannot find value `A` in module `super::super` --> src/main.rs:5:5 | 5 | bitflags! { | _____^ starting here... 6 | | flags Flags: u8 { 7 | | const A = 1, 8 | | const B = 2, 9 | | } 10 | | } | |_____^ ...ending here: not found in `super::super` | = note: this error originates in a macro outside of the current crate ```
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#71
No description provided.