Skip to content

Commit

Permalink
Fix cross-crate packed structs
Browse files Browse the repository at this point in the history
  • Loading branch information
sanxiyn committed May 6, 2013
1 parent 6e6a4be commit 502817a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
}

encode_name(ecx, ebml_w, item.ident);
encode_attributes(ebml_w, item.attrs);
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
encode_region_param(ecx, ebml_w, item);

Expand Down
5 changes: 5 additions & 0 deletions src/test/auxiliary/packed.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[packed]
struct S {
a: u8,
b: u32
}
8 changes: 8 additions & 0 deletions src/test/run-pass/packed-struct-size-xc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// xfail-fast
// aux-build:packed.rs

extern mod packed;

fn main() {
assert_eq!(sys::size_of::<packed::S>(), 5);
}

0 comments on commit 502817a

Please sign in to comment.