|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -// ignore-test #7340 fails on 32-bit linux |
12 | | -use std::ptr; |
| 11 | +// ignore-linux #7340 fails on 32-bit linux |
| 12 | +// ignore-macos #7340 fails on 32-bit macos |
13 | 13 |
|
14 | | -enum a_tag<A,B> { |
15 | | - varA(A), |
16 | | - varB(B) |
| 14 | +use std::cast; |
| 15 | + |
| 16 | +enum Tag<A,B> { |
| 17 | + VarA(A), |
| 18 | + VarB(B), |
17 | 19 | } |
18 | 20 |
|
19 | | -struct t_rec<A,B> { |
| 21 | +struct Rec<A,B> { |
20 | 22 | chA: u8, |
21 | | - tA: a_tag<A,B>, |
| 23 | + tA: Tag<A,B>, |
22 | 24 | chB: u8, |
23 | | - tB: a_tag<A,B> |
| 25 | + tB: Tag<A,B>, |
24 | 26 | } |
25 | 27 |
|
26 | | -fn mk_rec<A,B>(a: A, b: B) -> t_rec<A,B> { |
27 | | - return t_rec{ chA:0u8, tA:varA(a), chB:1u8, tB:varB(b) }; |
| 28 | +fn mk_rec<A,B>(a: A, b: B) -> Rec<A,B> { |
| 29 | + Rec { chA:0u8, tA:VarA(a), chB:1u8, tB:VarB(b) } |
28 | 30 | } |
29 | 31 |
|
30 | 32 | fn is_aligned<A>(amnt: uint, u: &A) -> bool { |
31 | | - let p = ptr::to_unsafe_ptr(u) as uint; |
| 33 | + let p: uint = unsafe { cast::transmute(u) }; |
32 | 34 | return (p & (amnt-1u)) == 0u; |
33 | 35 | } |
34 | 36 |
|
35 | | -fn variant_data_is_aligned<A,B>(amnt: uint, u: &a_tag<A,B>) -> bool { |
| 37 | +fn variant_data_is_aligned<A,B>(amnt: uint, u: &Tag<A,B>) -> bool { |
36 | 38 | match u { |
37 | | - &varA(ref a) => is_aligned(amnt, a), |
38 | | - &varB(ref b) => is_aligned(amnt, b) |
| 39 | + &VarA(ref a) => is_aligned(amnt, a), |
| 40 | + &VarB(ref b) => is_aligned(amnt, b) |
39 | 41 | } |
40 | 42 | } |
41 | 43 |
|
|
0 commit comments