]> git.proxmox.com Git - rustc.git/blob - tests/run-coverage/dead_code.rs
New upstream version 1.74.1+dfsg1
[rustc.git] / tests / run-coverage / dead_code.rs
1 #![allow(dead_code, unused_assignments, unused_variables)]
2
3 pub fn unused_pub_fn_not_in_library() {
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
15 fn unused_fn() {
16 // Initialize test constants in a way that cannot be determined at compile time, to ensure
17 // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
18 // dependent conditions.
19 let is_true = std::env::args().len() == 1;
20
21 let mut countdown = 0;
22 if is_true {
23 countdown = 10;
24 }
25 }
26
27 fn main() {
28 // Initialize test constants in a way that cannot be determined at compile time, to ensure
29 // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
30 // dependent conditions.
31 let is_true = std::env::args().len() == 1;
32
33 let mut countdown = 0;
34 if is_true {
35 countdown = 10;
36 }
37 }