{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/39","repository_url":"https://api.github.com/repos/rust-lang-nursery/bitflags","labels_url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/39/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/39/events","html_url":"https://github.com/rust-lang-nursery/bitflags/issues/39","id":137977958,"number":39,"title":"Allow using imported types","user":{"login":"xitep","id":8274125,"avatar_url":"https://avatars.githubusercontent.com/u/8274125?v=3","gravatar_id":"","url":"https://api.github.com/users/xitep","html_url":"https://github.com/xitep","followers_url":"https://api.github.com/users/xitep/followers","following_url":"https://api.github.com/users/xitep/following{/other_user}","gists_url":"https://api.github.com/users/xitep/gists{/gist_id}","starred_url":"https://api.github.com/users/xitep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitep/subscriptions","organizations_url":"https://api.github.com/users/xitep/orgs","repos_url":"https://api.github.com/users/xitep/repos","events_url":"https://api.github.com/users/xitep/events{/privacy}","received_events_url":"https://api.github.com/users/xitep/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-02T20:06:49Z","updated_at":"2016-03-04T07:24:35Z","closed_at":null,"body":"In short, the following should be possible:\r\n\r\n```\r\nextern crate libc;\r\nuse libc::c_uint;\r\nmod constants;\r\n\r\nbitflags! {\r\n    pub flags EnvFlags: c_uint {\r\n        const EnvNoSync = constants::MDB_NOSYNC,\r\n       // ...\r\n    }\r\n}\r\n```\r\n\r\nAs of #38, the above example will not compile. As a workaround, one can reference the imported types/modules within the bitflags definition using absolute paths, e.g. using `::libc::c_uint` instead of `c_uint` or `::constants::MDB_NOSYNC` instead of `constants::MDB_NOSYNC`. This is, at least, surprising.\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/comments/192156395","html_url":"https://github.com/rust-lang-nursery/bitflags/issues/39#issuecomment-192156395","issue_url":"https://api.github.com/repos/rust-lang-nursery/bitflags/issues/39","id":192156395,"user":{"login":"xitep","id":8274125,"avatar_url":"https://avatars.githubusercontent.com/u/8274125?v=3","gravatar_id":"","url":"https://api.github.com/users/xitep","html_url":"https://github.com/xitep","followers_url":"https://api.github.com/users/xitep/followers","following_url":"https://api.github.com/users/xitep/following{/other_user}","gists_url":"https://api.github.com/users/xitep/gists{/gist_id}","starred_url":"https://api.github.com/users/xitep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xitep/subscriptions","organizations_url":"https://api.github.com/users/xitep/orgs","repos_url":"https://api.github.com/users/xitep/repos","events_url":"https://api.github.com/users/xitep/events{/privacy}","received_events_url":"https://api.github.com/users/xitep/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T07:24:35Z","updated_at":"2016-03-04T07:24:35Z","body":"@dimbleby ... the following works for me:\r\n\r\n```\r\n#[macro_use]\r\nextern crate bitflags;\r\nextern crate liblmdb_sys;\r\n\r\nbitflags!(\r\n    pub flags Foo: i32 {\r\n        const ONE = ::liblmdb_sys::MDB_NOTFOUND,\r\n        const TWO = ::liblmdb_sys::MDB_KEYEXIST,\r\n    }\r\n);\r\n\r\nfn main() {\r\n    println!(\"{:?}\", ONE | TWO);\r\n}\r\n```\r\n"}}