]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/unary-minus-suffix-inference.rs
Merge tag 'debian/0.7-0_exp1'
[rustc.git] / src / test / run-pass / unary-minus-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 pub fn main() {
12 let a = 1;
13 let a_neg: i8 = -a;
14 error!(a_neg);
15
16 let b = 1;
17 let b_neg: i16 = -b;
18 error!(b_neg);
19
20 let c = 1;
21 let c_neg: i32 = -c;
22 error!(b_neg);
23
24 let d = 1;
25 let d_neg: i64 = -d;
26 error!(b_neg);
27
28 let e = 1;
29 let e_neg: int = -e;
30 error!(b_neg);
31
32 // intentional overflows
33
34 let f = 1;
35 let f_neg: u8 = -f;
36 error!(f_neg);
37
38 let g = 1;
39 let g_neg: u16 = -g;
40 error!(g_neg);
41
42 let h = 1;
43 let h_neg: u32 = -h;
44 error!(h_neg);
45
46 let i = 1;
47 let i_neg: u64 = -i;
48 error!(i_neg);
49
50 let j = 1;
51 let j_neg: uint = -j;
52 error!(j_neg);
53 }