about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSeo Sanghyeon <sanxiyn@gmail.com>2013-05-06 23:35:27 +0900
committerSeo Sanghyeon <sanxiyn@gmail.com>2013-05-06 23:35:27 +0900
commit502817a9c19752cafcc270d9d3e5a5104ce2eac9 (patch)
treecf01e2a077a012f758c30a7a85125b06f6b08e6e
parent6e6a4be19d8e6a2cedc66be6cc602db8a1e71acd (diff)
downloadrust-502817a9c19752cafcc270d9d3e5a5104ce2eac9.tar.gz
rust-502817a9c19752cafcc270d9d3e5a5104ce2eac9.zip
Fix cross-crate packed structs
-rw-r--r--src/librustc/metadata/encoder.rs1
-rw-r--r--src/test/auxiliary/packed.rs5
-rw-r--r--src/test/run-pass/packed-struct-size-xc.rs8
3 files changed, 14 insertions, 0 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 6a9c564f368..7db362c6920 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -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);
 
diff --git a/src/test/auxiliary/packed.rs b/src/test/auxiliary/packed.rs
new file mode 100644
index 00000000000..478d51b540c
--- /dev/null
+++ b/src/test/auxiliary/packed.rs
@@ -0,0 +1,5 @@
+#[packed]
+struct S {
+    a: u8,
+    b: u32
+}
diff --git a/src/test/run-pass/packed-struct-size-xc.rs b/src/test/run-pass/packed-struct-size-xc.rs
new file mode 100644
index 00000000000..ddfc2b17aa7
--- /dev/null
+++ b/src/test/run-pass/packed-struct-size-xc.rs
@@ -0,0 +1,8 @@
+// xfail-fast
+// aux-build:packed.rs
+
+extern mod packed;
+
+fn main() {
+    assert_eq!(sys::size_of::<packed::S>(), 5);
+}