]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2015 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // Test that we can do shifts by any integral type. | |
12 | ||
c34b1796 AL |
13 | // pretty-expanded FIXME #23616 |
14 | ||
1a4d82fc JJ |
15 | struct Panolpy { |
16 | i8: i8, | |
17 | i16: i16, | |
18 | i32: i32, | |
19 | i64: i64, | |
20 | isize: isize, | |
21 | ||
22 | u8: u8, | |
23 | u16: u16, | |
24 | u32: u32, | |
25 | u64: u64, | |
26 | usize: usize, | |
27 | } | |
28 | ||
29 | fn foo(p: &Panolpy) { | |
c34b1796 AL |
30 | assert_eq!(22 >> p.i8, 11); |
31 | assert_eq!(22 >> p.i16, 11); | |
32 | assert_eq!(22 >> p.i32, 11); | |
33 | assert_eq!(22 >> p.i64, 11); | |
34 | assert_eq!(22 >> p.isize, 11); | |
35 | ||
36 | assert_eq!(22 >> p.u8, 11); | |
37 | assert_eq!(22 >> p.u16, 11); | |
38 | assert_eq!(22 >> p.u32, 11); | |
39 | assert_eq!(22 >> p.u64, 11); | |
40 | assert_eq!(22 >> p.usize, 11); | |
1a4d82fc JJ |
41 | } |
42 | ||
43 | fn main() { | |
44 | let p = Panolpy { | |
45 | i8: 1, | |
46 | i16: 1, | |
47 | i32: 1, | |
48 | i64: 1, | |
49 | isize: 1, | |
50 | ||
51 | u8: 1, | |
52 | u16: 1, | |
53 | u32: 1, | |
54 | u64: 1, | |
55 | usize: 1, | |
56 | }; | |
57 | foo(&p) | |
58 | } |