Skip to content

Commit 09624a6

Browse files
committed
test: Enable an assert in run-pass/rec-align-32-bit.rs
1 parent e427747 commit 09624a6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/test/run-pass/rec-align-32-bit.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
// xfail-win32
33
// Issue #2303
44

5+
#[abi = "rust-intrinsic"]
6+
native mod rusti {
7+
fn pref_align_of<T>() -> uint;
8+
fn min_align_of<T>() -> uint;
9+
}
10+
511
// This is the type with the questionable alignment
612
type inner = {
713
c64: u64
@@ -22,24 +28,18 @@ fn main() {
2228
// Send it through the shape code
2329
let y = #fmt["%?", x];
2430

25-
#debug("align inner = %?", sys::pref_align_of::<inner>()); // 8
26-
#debug("size outer = %?", sys::size_of::<outer>()); // 12
27-
#debug("y = %s", y); // (22, (0))
31+
#debug("align inner = %?", rusti::min_align_of::<inner>());
32+
#debug("size outer = %?", sys::size_of::<outer>());
33+
#debug("y = %s", y);
2834

2935
// per clang/gcc the alignment of `inner` is 4 on x86.
30-
// we say it's 8
31-
//assert sys::align_of::<inner>() == 4u; // fails
36+
assert rusti::min_align_of::<inner>() == 4u;
3237

3338
// per clang/gcc the size of `outer` should be 12
3439
// because `inner`s alignment was 4.
35-
// LLVM packs the struct the way clang likes, despite
36-
// our intents regarding the alignment of `inner` and
37-
// we end up with the same size `outer` as clang
38-
assert sys::size_of::<outer>() == 12u; // passes
39-
40-
// But now our shape code doesn't find the inner struct
41-
// We print (22, (0))
42-
assert y == "(22, (44))"; // fails
40+
assert sys::size_of::<outer>() == 12u;
41+
42+
assert y == "(22, (44))";
4343
}
4444

4545
#[cfg(target_arch = "x86_64")]

0 commit comments

Comments
 (0)