1
Fork 0

Better detection of repr packed and align

Fixes issue #43317.
This commit is contained in:
Cameron Hart 2017-07-23 17:27:13 +10:00
parent 504328a31a
commit 200c4d0410
5 changed files with 21 additions and 19 deletions

View file

@ -76,8 +76,6 @@ impl<'a> CheckAttrVisitor<'a> {
};
let mut conflicting_reprs = 0;
let mut found_packed = false;
let mut found_align = false;
for word in words {
@ -106,7 +104,6 @@ impl<'a> CheckAttrVisitor<'a> {
("attribute should be applied to struct or union",
"a struct or union")
} else {
found_packed = true;
continue
}
}
@ -120,7 +117,6 @@ impl<'a> CheckAttrVisitor<'a> {
}
}
"align" => {
found_align = true;
if target != Target::Struct &&
target != Target::Union {
("attribute should be applied to struct or union",
@ -150,10 +146,6 @@ impl<'a> CheckAttrVisitor<'a> {
span_warn!(self.sess, attr.span, E0566,
"conflicting representation hints");
}
if found_align && found_packed {
struct_span_err!(self.sess, attr.span, E0587,
"conflicting packed and align representation hints").emit();
}
}
}