1 1| |#![allow(unused_assignments, unused_variables)]
3 3| |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
5 5| |use std::fmt::Debug;
7 7| 1|pub fn used_function() {
8 8| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
9 9| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
10 10| 1| // dependent conditions.
11 11| 1| let is_true = std::env::args().len() == 1;
12 12| 1| let mut countdown = 0;
14 14| 1| countdown = 10;
17 16| 1| use_this_lib_crate();
20 19| |#[inline(always)]
21 20| 1|pub fn used_inline_function() {
22 21| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
23 22| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
24 23| 1| // dependent conditions.
25 24| 1| let is_true = std::env::args().len() == 1;
26 25| 1| let mut countdown = 0;
28 27| 1| countdown = 10;
31 29| 1| use_this_lib_crate();
40 38| |#[inline(always)]
41 39| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
42 40| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
45 | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
46 | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
47 | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
50 | used_inline_crate::used_only_from_bin_crate_generic_function::<&str>:
51 | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
52 | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg);
55 | Unexecuted instantiation: used_inline_crate::used_only_from_bin_crate_generic_function::<_>
57 42| |// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`)
59 44| |#[inline(always)]
60 45| 4|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
61 46| 4| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
64 | used_inline_crate::used_only_from_this_lib_crate_generic_function::<&str>:
65 | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
66 | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
69 | used_inline_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
70 | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
71 | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
75 49| |#[inline(always)]
76 50| 3|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
77 51| 3| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
80 | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
81 | 50| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
82 | 51| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
85 | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>:
86 | 50| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
87 | 51| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
91 54| |#[inline(always)]
92 55| 3|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
93 56| 3| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
96 | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
97 | 55| 1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
98 | 56| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
101 | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
102 | 55| 2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
103 | 56| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
107 59| |#[inline(always)]
108 60| 0|pub fn unused_generic_function<T: Debug>(arg: T) {
109 61| 0| println!("unused_generic_function with {:?}", arg);
112 64| |#[inline(always)]
113 65| 0|pub fn unused_function() {
114 66| 0| let is_true = std::env::args().len() == 1;
115 67| 0| let mut countdown = 2;
117 69| 0| countdown = 20;
121 73| |#[inline(always)]
122 74| 0|fn unused_private_function() {
123 75| 0| let is_true = std::env::args().len() == 1;
124 76| 0| let mut countdown = 2;
126 78| 0| countdown = 20;
130 82| 2|fn use_this_lib_crate() {
131 83| 2| used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs");
132 84| 2| used_with_same_type_from_bin_crate_and_lib_crate_generic_function(
133 85| 2| "used from library used_crate.rs",
135 87| 2| let some_vec = vec![5, 6, 7, 8];
136 88| 2| used_only_from_this_lib_crate_generic_function(some_vec);
137 89| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs");