]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/integer-literal-suffix-inference.rs
Merge pull request #4144 from luqmana/deprecated-attribute
[rust.git] / src / test / run-pass / integer-literal-suffix-inference.rs
1 // Copyright 2012 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 fn main() {
12     fn id_i8(n: i8) -> i8 { n }
13     fn id_i16(n: i16) -> i16 { n }
14     fn id_i32(n: i32) -> i32 { n }
15     fn id_i64(n: i64) -> i64 { n }
16
17     fn id_uint(n: uint) -> uint { n }
18     fn id_u8(n: u8) -> u8 { n }
19     fn id_u16(n: u16) -> u16 { n }
20     fn id_u32(n: u32) -> u32 { n }
21     fn id_u64(n: u64) -> u64 { n }
22
23     let _i: i8 = -128;
24     let j = -128;
25     id_i8(j);
26     id_i8(-128);
27
28     let _i: i16 = -32_768;
29     let j = -32_768;
30     id_i16(j);
31     id_i16(-32_768);
32
33     let _i: i32 = -2_147_483_648;
34     let j = -2_147_483_648;
35     id_i32(j);
36     id_i32(-2_147_483_648);
37
38     let _i: i64 = -9_223_372_036_854_775_808;
39     let j = -9_223_372_036_854_775_808;
40     id_i64(j);
41     id_i64(-9_223_372_036_854_775_808);
42
43     let _i: uint = 1;
44     let j = 1;
45     id_uint(j);
46     id_uint(1);
47
48     let _i: u8 = 255;
49     let j = 255;
50     id_u8(j);
51     id_u8(255);
52
53     let _i: u16 = 65_535;
54     let j = 65_535;
55     id_u16(j);
56     id_u16(65_535);
57
58     let _i: u32 = 4_294_967_295;
59     let j = 4_294_967_295;
60     id_u32(j);
61     id_u32(4_294_967_295);
62
63     let _i: u64 = 18_446_744_073_709_551_615;
64     let j = 18_446_744_073_709_551_615;
65     id_u64(j);
66     id_u64(18_446_744_073_709_551_615);
67 }