Debian Codegraph @

gcc/testsuite/rust/execute/torture/match_range2.rs

raw
1 // { dg-output "lowercase\r*\nuppercase\r*\nother\r*\n" }
2
3 extern "C" {
4 fn printf(s: *const i8, ...);
5 }
6
7 const BIG_A: char = 'A';
8 const BIG_Z: char = 'Z';
9
10 fn bar(x: char) {
11 match x {
12 'a'..='z' => {
13 let a = "lowercase\n\0";
14 let b = a as *const str;
15 let c = b as *const i8;
16 unsafe {
17 printf(c);
18 }
19 }
20 BIG_A..=BIG_Z => {
21 let a = "uppercase\n\0";
22 let b = a as *const str;
23 let c = b as *const i8;
24 unsafe {
25 printf(c);
26 }
27 }
28 _ => {
29 let a = "other\n\0";
30 let b = a as *const str;
31 let c = b as *const i8;
32 unsafe {
33 printf(c);
34 }
35 }
36 }
37 }
38
39 fn main() -> i32 {
40 bar('b');
41 bar('X');
42 bar('!');
43
44 0
45 }