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