aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/arithmetic_expressions1.rs
blob: 4c3ee77c835418b7a4093b65c7d35c56e1040594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// { dg-prune-output "warning: unused name" } as there are many of these expected.

fn main() {
    let a: i32 = 1;
    let b: f32 = 5f32;
    let c: bool = true;

    let a1: i32 = a + 1;
    let a2: i32 = a - 2;
    let a3: i32 = a * 3;
    let a4: i32 = a / 4;
    let a5: i32 = a % 5;

    let b1: f32 = b + 1f32;
    let b2: f32 = b - 2f32;
    let b3: f32 = b * 3f32;
    let b4: f32 = b / 4f32;
    // let b5: f32 = b % 5f32;

    let aa1: i32 = a & 1;
    let aa2: i32 = a | 2;
    let aa2: i32 = a ^ 3;

    let c1: bool = c & true;
    let c2: bool = c | false;
    let c3: bool = c ^ true;

    let aaa1: i32 = a << 1;
    let aaa2: i32 = a >> 2;
}