Allow using imported types #39
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#39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
In short, the following should be possible:
As 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_uintinstead ofc_uintor::constants::MDB_NOSYNCinstead ofconstants::MDB_NOSYNC. This is, at least, surprising.I've been unable even to find a workaround that will allow an example like this to compile with 0.5.0:
... as for example here.
Probably I'm missing some incantation. But was it intended that such things should break?
Right now the workaround is to use absolute paths, but it's unfortunately not great yeah
But I don't think that this workaround works in this case, does it? Or if you think that it does, could you spell out for me how I can apply it?
Thanks!
Ah it may not work, I haven't personally tested it myself
@dimbleby ... the following works for me:
Hmm. When I make the same change in my code (linked above) I get errors like this:
What's the difference?
I'd rather have this unbroken than enjoy the cosmetic benefits of #14.
But perhaps the implementation in the inner modules could use
u64instead of the parameter type?Note also this reimplementation by @Amanieu: https://github.com/rust-lang-nursery/bitflags/issues/21#issuecomment-160230866
Any way we could fix this @alexcrichton?
PRs always welcome! I suspect the fix would be pretty simple
I tried fixing this myself a while back but I couldn't get it to work properly with macro hygiene.
@alexcrichton I tried too, hence me asking you to look into it. :)
We can probably just revert the PR that introduced this, IIRC it's a feature that wasn't as nice to have as what this bug is about.
Fixed.