Debian Codegraph @

gcc/testsuite/rust/execute/torture/issue-858.rs

raw
1 /* { dg-output "Result: 123\r*\n" } */
2 extern "C" {
3 fn printf(s: *const i8, ...);
4 }
5
6 #[lang = "sized"]
7 pub trait Sized {}
8
9 enum Foo<T> {
10 A,
11 B(T),
12 }
13
14 fn main() -> i32 {
15 let result = Foo::B(123);
16
17 match result {
18 Foo::A => unsafe {
19 let a = "A\n\0";
20 let b = a as *const str;
21 let c = b as *const i8;
22
23 printf(c);
24 },
25 Foo::B(x) => unsafe {
26 let a = "Result: %i\n\0";
27 let b = a as *const str;
28 let c = b as *const i8;
29
30 printf(c, x);
31 },
32 }
33
34 0
35 }