]> git.lizzy.rs Git - rust.git/blob - tests/run-make/coverage/inner_items.rs
Remove confusing 'while checking' note from opaque future type mismatches
[rust.git] / tests / run-make / coverage / inner_items.rs
1 #![allow(unused_assignments, unused_variables, dead_code)]
2
3 fn main() {
4     // Initialize test constants in a way that cannot be determined at compile time, to ensure
5     // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
6     // dependent conditions.
7     let is_true = std::env::args().len() == 1;
8
9     let mut countdown = 0;
10     if is_true {
11         countdown = 10;
12     }
13
14     mod in_mod {
15         const IN_MOD_CONST: u32 = 1000;
16     }
17
18     fn in_func(a: u32) {
19         let b = 1;
20         let c = a + b;
21         println!("c = {}", c)
22     }
23
24     struct InStruct {
25         in_struct_field: u32,
26     }
27
28     const IN_CONST: u32 = 1234;
29
30     trait InTrait {
31         fn trait_func(&mut self, incr: u32);
32
33         fn default_trait_func(&mut self) {
34             in_func(IN_CONST);
35             self.trait_func(IN_CONST);
36         }
37     }
38
39     impl InTrait for InStruct {
40         fn trait_func(&mut self, incr: u32) {
41             self.in_struct_field += incr;
42             in_func(self.in_struct_field);
43         }
44     }
45
46     type InType = String;
47
48     if is_true {
49         in_func(countdown);
50     }
51
52     let mut val = InStruct {
53         in_struct_field: 101,
54     };
55
56     val.default_trait_func();
57 }