1
Fork 0

Implementation of #[repr(packed(n))] RFC 1399.

This commit is contained in:
Cameron Hart 2018-02-04 22:10:28 +11:00
parent ca26ef321c
commit 15d1c4d213
26 changed files with 849 additions and 167 deletions

View file

@ -413,8 +413,12 @@ impl<'a> TraitDef<'a> {
match *item {
Annotatable::Item(ref item) => {
let is_packed = item.attrs.iter().any(|attr| {
attr::find_repr_attrs(&cx.parse_sess.span_diagnostic, attr)
.contains(&attr::ReprPacked)
for r in attr::find_repr_attrs(&cx.parse_sess.span_diagnostic, attr) {
if let attr::ReprPacked(_) = r {
return true;
}
}
false
});
let has_no_type_params = match item.node {
ast::ItemKind::Struct(_, ref generics) |
@ -831,7 +835,7 @@ fn find_repr_type_name(diagnostic: &Handler, type_attrs: &[ast::Attribute]) -> &
for a in type_attrs {
for r in &attr::find_repr_attrs(diagnostic, a) {
repr_type_name = match *r {
attr::ReprPacked | attr::ReprSimd | attr::ReprAlign(_) | attr::ReprTransparent =>
attr::ReprPacked(_) | attr::ReprSimd | attr::ReprAlign(_) | attr::ReprTransparent =>
continue,
attr::ReprC => "i32",