libstd: convert BitFlags unops to by value

This commit is contained in:
Jorge Aparicio 2014-12-15 17:06:10 -05:00
parent 5359879fb6
commit 340f042e03

View file

@ -281,6 +281,8 @@ macro_rules! bitflags {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Not<$BitFlags> for $BitFlags {
/// Returns the complement of this set of flags.
#[inline]
@ -288,6 +290,15 @@ macro_rules! bitflags {
$BitFlags { bits: !self.bits } & $BitFlags::all()
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Not<$BitFlags> for $BitFlags {
/// Returns the complement of this set of flags.
#[inline]
fn not(self) -> $BitFlags {
$BitFlags { bits: !self.bits } & $BitFlags::all()
}
}
};
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+,