gcc/testsuite/rust/execute/torture/name_resolution.rs
raw| 1 | // { dg-additional-options "-frust-name-resolution-2.0" } |
| 2 | // { dg-output "Value is 10\r*\n" } |
| 3 | |
| 4 | const BAZ: i32 = 10; |
| 5 | |
| 6 | extern "C" { |
| 7 | fn printf(s: *const i8, ...); |
| 8 | } |
| 9 | |
| 10 | fn foo() { |
| 11 | fn bar() { |
| 12 | let e = BAZ; |
| 13 | unsafe { |
| 14 | printf("Value is %i\n" as *const str as *const i8, e); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | bar(); |
| 19 | } |
| 20 | |
| 21 | fn main() -> i32 { |
| 22 | foo(); |
| 23 | 0 |
| 24 | } |