Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function-local bitflags #71

Closed
dtolnay opened this issue Mar 7, 2017 · 0 comments
Closed

Function-local bitflags #71

dtolnay opened this issue Mar 7, 2017 · 0 comments

Comments

@dtolnay
Copy link
Contributor

dtolnay commented Mar 7, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant