Add private bitflags #38
No reviewers
Labels
No labels
bug
good first issue
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-bitflags/bitflags!38
Loading…
Reference in a new issue
No description provided.
Delete branch "private_bitflags"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds the ability to define private bitflags that aren't exported outside of the current module using
priv flags.Ideally this would be done by matching the existing behavior in the language: making private bitflags the default behavior and requiring the use of
pub flagsto export it outside the mode. However there are a large number of crates that usebitflagswith a*version, which makes me somewhat nervous to break them all.Fixes #25
I agree that private is the better default (e.g. matches Rust) and requiring an explicit
pubis the best way to go here, so I'd personally prefer to go in that direction.I changed it to private by default and requiring an explicit
pub. However I am still worried that this will break a lot of crates that usebitflagswith a*version: https://crates.io/crates/bitflags/reverse_dependenciesAh yeah it's true that this may break some crates, but
*dependencies are no longer allowed on crates.io and those are ones that probably need to be updated anyway. I wouldn't necessarily want to be locked in to prevent any breaking changes so it seems fine to do this.Thanks again @Amanieu!
There's a confusing situation now: 0.4.0 from git master and the documentation at
doc.rlohave default private but the latest crates.io 0.4.0 package has default public.This is because this PR hasn't been pushed to crates.io yet.
On Sun, Feb 28, 2016 at 12:31 PM, Gleb Kozyrev notifications@github.com
wrote:
I've published 0.5.0 now with this change.
hello, it looks like after this change bitflags are forced to standard types, e.g. u32. is this an accident or purpose?
the
lmdb-rsproject - which i tried to upgrade - uses amongst others libc::c_uint in its bitflags definitions. but i see no possibility to include the correspondinguse libc::c_uintdeclaration in the newly generateddummymodule.any advice for me?
@xitep I think the best advice would be to just use
u32for now.libc::c_uintis going to be equivalent to that type on most sane platforms anyways.@alexcrichton I tried fixing this but couldn't figure out a way to reliably pass the type down to the dummy module (
typedoesn't seem to be covered by macro hygiene). Note that the associated constants version (#24) doesn't have this issue since it doesn't use dummy modules.Can't you use an absolute path like
::libc::c_uint?@alexcrichton thank you! yes, absolute references make it!
is this the long term plan or do we plan for another solution?
Probably, this library is in a relatively bad state unfortunately. Can you open an issue on this?