Skip to content

Commit 29eecce

Browse files
committed
---
yaml --- r: 193474 b: refs/heads/beta c: 340d1cc h: refs/heads/master v: v3
1 parent 029a039 commit 29eecce

File tree

4 files changed

+28
-34
lines changed

4 files changed

+28
-34
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 455aa62e4d3766f0b092015c3e15d089bbe2129f
34+
refs/heads/beta: 340d1cc7d701bf1c5bae6c2ad5b097462c5d1a7c
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/test/run-pass/tag-align-dyn-u64.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-linux #7340 fails on 32-bit Linux
12-
// ignore-macos #7340 fails on 32-bit macos
13-
1411
use std::mem;
1512

1613
enum Tag<A> {
@@ -26,12 +23,13 @@ fn mk_rec() -> Rec {
2623
return Rec { c8:0, t:Tag::Tag2(0) };
2724
}
2825

29-
fn is_8_byte_aligned(u: &Tag<u64>) -> bool {
26+
fn is_u64_aligned(u: &Tag<u64>) -> bool {
3027
let p: uint = unsafe { mem::transmute(u) };
31-
return (p & 7) == 0;
28+
let u64_align = std::mem::min_align_of::<u64>();
29+
return (p & (u64_align - 1)) == 0;
3230
}
3331

3432
pub fn main() {
3533
let x = mk_rec();
36-
assert!(is_8_byte_aligned(&x.t));
34+
assert!(is_u64_aligned(&x.t));
3735
}

branches/beta/src/test/run-pass/tag-align-dyn-variants.rs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-linux #7340 fails on 32-bit Linux
12-
// ignore-macos #7340 fails on 32-bit macos
13-
1411
use std::mem;
1512

1613
enum Tag<A,B> {
@@ -42,33 +39,34 @@ fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool {
4239
}
4340

4441
pub fn main() {
45-
let x = mk_rec(22, 23);
46-
assert!(is_aligned(8, &x.tA));
47-
assert!(variant_data_is_aligned(8, &x.tA));
48-
assert!(is_aligned(8, &x.tB));
49-
assert!(variant_data_is_aligned(8, &x.tB));
42+
let u64_align = std::mem::min_align_of::<u64>();
43+
let x = mk_rec(22u64, 23u64);
44+
assert!(is_aligned(u64_align, &x.tA));
45+
assert!(variant_data_is_aligned(u64_align, &x.tA));
46+
assert!(is_aligned(u64_align, &x.tB));
47+
assert!(variant_data_is_aligned(u64_align, &x.tB));
5048

51-
let x = mk_rec(22, 23);
52-
assert!(is_aligned(8, &x.tA));
53-
assert!(variant_data_is_aligned(8, &x.tA));
54-
assert!(is_aligned(8, &x.tB));
49+
let x = mk_rec(22u64, 23u32);
50+
assert!(is_aligned(u64_align, &x.tA));
51+
assert!(variant_data_is_aligned(u64_align, &x.tA));
52+
assert!(is_aligned(u64_align, &x.tB));
5553
assert!(variant_data_is_aligned(4, &x.tB));
5654

57-
let x = mk_rec(22, 23);
58-
assert!(is_aligned(8, &x.tA));
55+
let x = mk_rec(22u32, 23u64);
56+
assert!(is_aligned(u64_align, &x.tA));
5957
assert!(variant_data_is_aligned(4, &x.tA));
60-
assert!(is_aligned(8, &x.tB));
61-
assert!(variant_data_is_aligned(8, &x.tB));
58+
assert!(is_aligned(u64_align, &x.tB));
59+
assert!(variant_data_is_aligned(u64_align, &x.tB));
6260

63-
let x = mk_rec(22, 23);
61+
let x = mk_rec(22u32, 23u32);
6462
assert!(is_aligned(4, &x.tA));
6563
assert!(variant_data_is_aligned(4, &x.tA));
6664
assert!(is_aligned(4, &x.tB));
6765
assert!(variant_data_is_aligned(4, &x.tB));
6866

6967
let x = mk_rec(22f64, 23f64);
70-
assert!(is_aligned(8, &x.tA));
71-
assert!(variant_data_is_aligned(8, &x.tA));
72-
assert!(is_aligned(8, &x.tB));
73-
assert!(variant_data_is_aligned(8, &x.tB));
68+
assert!(is_aligned(u64_align, &x.tA));
69+
assert!(variant_data_is_aligned(u64_align, &x.tA));
70+
assert!(is_aligned(u64_align, &x.tB));
71+
assert!(variant_data_is_aligned(u64_align, &x.tB));
7472
}

branches/beta/src/test/run-pass/tag-align-u64.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// ignore-linux #7340 fails on 32-bit Linux
12-
// ignore-macos #7340 fails on 32-bit macos
13-
1411
use std::mem;
1512

1613
enum Tag {
@@ -26,12 +23,13 @@ fn mk_rec() -> Rec {
2623
return Rec { c8:0, t:Tag::TagInner(0) };
2724
}
2825

29-
fn is_8_byte_aligned(u: &Tag) -> bool {
26+
fn is_u64_aligned(u: &Tag) -> bool {
3027
let p: uint = unsafe { mem::transmute(u) };
31-
return (p & 7) == 0;
28+
let u64_align = std::mem::min_align_of::<u64>();
29+
return (p & (u64_align - 1)) == 0;
3230
}
3331

3432
pub fn main() {
3533
let x = mk_rec();
36-
assert!(is_8_byte_aligned(&x.t));
34+
assert!(is_u64_aligned(&x.t));
3735
}

0 commit comments

Comments
 (0)