aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/name_resolution.rs
blob: 749218352d648c077cbc53364fd04632001fa974 (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
// { dg-additional-options "-frust-name-resolution-2.0" }
// { dg-output "Value is 10\r*\n" }

const BAZ: i32 = 10;

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

fn foo() {
    fn bar() {
        let e = BAZ;
        unsafe {
            printf("Value is %i\n" as *const str as *const i8, e);
        }
    }

    bar();
}

fn main() -> i32 {
    foo();
    0
}