diff options
| author | bors <bors@rust-lang.org> | 2014-05-06 12:41:55 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-06 12:41:55 -0700 |
| commit | cf6857b9e9427f14d383ae2924555bedc251fa02 (patch) | |
| tree | 045b617609058f5042495fd4172b2f2924179360 /src/rustllvm/RustWrapper.cpp | |
| parent | 1f6db7f4f6399628eaaca5d38cc5fb38e71b4c23 (diff) | |
| parent | 8d1d7d9b5f3920d70b1edcc258a86106527e83f7 (diff) | |
| download | rust-cf6857b9e9427f14d383ae2924555bedc251fa02.tar.gz rust-cf6857b9e9427f14d383ae2924555bedc251fa02.zip | |
auto merge of #13897 : aturon/rust/issue-6085, r=bjz
The `std::bitflags::bitflags!` macro did not provide support for
adding attributes to the generates structure, due to limitations in
the parser for macros. This patch works around the parser limitations
by requiring a `flags` keyword in the `bitflags!` invocations:
bitflags!(
#[deriving(Hash)]
#[doc="Three flags"]
flags Flags: u32 {
FlagA = 0x00000001,
FlagB = 0x00000010,
FlagC = 0x00000100
}
)
The intent of `std::bitflags` is to allow building type-safe wrappers
around C-style flags APIs. But in addition to construction these flags
from the Rust side, we need a way to convert them from the C
side. This patch adds a `from_bits` function, which is unsafe since
the bits in question may not represent a valid combination of flags.
Finally, this patch changes `std::io::FilePermissions` from an exposed
`u32` representation to a typesafe representation (that only allows valid
flag combinations) using the `std::bitflags`.
Closes #6085.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
