aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/issue-1323-1.rs
blob: a6174253a21357435ed9b3ade4aa8d33ea6e8f25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
fn main() {
    let mut x = [1, 2, 3];
    let y: i32 = x[0];
    print_int(y);
}

extern "C" {
    fn printf(s: *const i8, ...);
}

fn print_int(value: i32) {
    let s = "%d\n\0";
    let s_p = s as *const str;
    let c_p = s_p as *const i8;
    unsafe {
        printf(c_p, value as isize);
    }
}