More robust Display for flags types

Fixes strange behavior if a Vulkan flags constant setting multiple bits
is defined prior to that which sets only one of those bits.
This commit is contained in:
Benjamin Saunders 2018-08-21 00:24:01 -07:00
parent d99ac29747
commit a0424596a5
2 changed files with 1486 additions and 1486 deletions

File diff suppressed because it is too large Load diff

View file

@ -1515,7 +1515,7 @@ pub fn generate_const_displays<'a>(const_values: &HashMap<Ident, Vec<Ident>>) ->
let mut first = true;
let mut accum = value;
for (bit, name) in known {
if accum & bit != 0 {
if *bit != 0 && accum & *bit == *bit {
if !first { f.write_str(" | ")?; }
f.write_str(name)?;
first = false;