|
30 | 30 | ^0 |
31 | 31 | 29| 1| use_this_lib_crate(); |
32 | 32 | 30| 1|} |
33 | | - ------------------ |
34 | | - | used_inline_crate::used_inline_function: |
35 | | - | 20| 1|pub fn used_inline_function() { |
36 | | - | 21| | // Initialize test constants in a way that cannot be determined at compile time, to ensure |
37 | | - | 22| | // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from |
38 | | - | 23| | // dependent conditions. |
39 | | - | 24| 1| let is_true = std::env::args().len() == 1; |
40 | | - | 25| 1| let mut countdown = 0; |
41 | | - | 26| 1| if is_true { |
42 | | - | 27| 1| countdown = 10; |
43 | | - | 28| 1| } |
44 | | - | ^0 |
45 | | - | 29| 1| use_this_lib_crate(); |
46 | | - | 30| 1|} |
47 | | - ------------------ |
48 | | - | Unexecuted instantiation: used_inline_crate::used_inline_function |
49 | | - ------------------ |
50 | | - 31| |// Expect for above function: |
51 | | - 32| |// |
52 | | - 33| |// | Unexecuted instantiation: used_crate::used_only_from_bin_crate_generic_function::<_> |
53 | | - 34| |// |
54 | | - 35| |// With `#[inline(always)]` this function is instantiated twice, in both the library crate (which |
55 | | - 36| |// does not use it) and the `uses_inline_crate` binary (which does use/call it). |
56 | | - 37| | |
57 | | - 38| |#[inline(always)] |
58 | | - 39| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
59 | | - 40| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
60 | | - 41| 2|} |
| 33 | + 31| | |
| 34 | + 32| |#[inline(always)] |
| 35 | + 33| 2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
| 36 | + 34| 2| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
| 37 | + 35| 2|} |
61 | 38 | ------------------ |
62 | 39 | | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>: |
63 | | - | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
64 | | - | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
65 | | - | 41| 1|} |
| 40 | + | 33| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
| 41 | + | 34| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
| 42 | + | 35| 1|} |
66 | 43 | ------------------ |
67 | 44 | | used_inline_crate::used_only_from_bin_crate_generic_function::<&str>: |
68 | | - | 39| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
69 | | - | 40| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
70 | | - | 41| 1|} |
| 45 | + | 33| 1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { |
| 46 | + | 34| 1| println!("used_only_from_bin_crate_generic_function with {:?}", arg); |
| 47 | + | 35| 1|} |
71 | 48 | ------------------ |
72 | 49 | | Unexecuted instantiation: used_inline_crate::used_only_from_bin_crate_generic_function::<_> |
73 | 50 | ------------------ |
74 | | - 42| |// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`) |
75 | | - 43| | |
76 | | - 44| |#[inline(always)] |
77 | | - 45| 4|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
78 | | - 46| 4| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
79 | | - 47| 4|} |
| 51 | + 36| |// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`) |
| 52 | + 37| | |
| 53 | + 38| |#[inline(always)] |
| 54 | + 39| 4|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
| 55 | + 40| 4| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
| 56 | + 41| 4|} |
80 | 57 | ------------------ |
81 | 58 | | used_inline_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>: |
82 | | - | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
83 | | - | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
84 | | - | 47| 2|} |
| 59 | + | 39| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
| 60 | + | 40| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
| 61 | + | 41| 2|} |
85 | 62 | ------------------ |
86 | 63 | | used_inline_crate::used_only_from_this_lib_crate_generic_function::<&str>: |
87 | | - | 45| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
88 | | - | 46| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
89 | | - | 47| 2|} |
| 64 | + | 39| 2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) { |
| 65 | + | 40| 2| println!("used_only_from_this_lib_crate_generic_function with {:?}", arg); |
| 66 | + | 41| 2|} |
90 | 67 | ------------------ |
91 | | - 48| | |
92 | | - 49| |#[inline(always)] |
93 | | - 50| 3|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
94 | | - 51| 3| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
95 | | - 52| 3|} |
| 68 | + 42| | |
| 69 | + 43| |#[inline(always)] |
| 70 | + 44| 3|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 71 | + 45| 3| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 72 | + 46| 3|} |
96 | 73 | ------------------ |
97 | 74 | | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>: |
98 | | - | 50| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
99 | | - | 51| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
100 | | - | 52| 1|} |
| 75 | + | 44| 1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 76 | + | 45| 1| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 77 | + | 46| 1|} |
101 | 78 | ------------------ |
102 | 79 | | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>: |
103 | | - | 50| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
104 | | - | 51| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
105 | | - | 52| 2|} |
| 80 | + | 44| 2|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 81 | + | 45| 2| println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 82 | + | 46| 2|} |
106 | 83 | ------------------ |
107 | | - 53| | |
108 | | - 54| |#[inline(always)] |
109 | | - 55| 3|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
110 | | - 56| 3| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
111 | | - 57| 3|} |
| 84 | + 47| | |
| 85 | + 48| |#[inline(always)] |
| 86 | + 49| 3|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 87 | + 50| 3| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 88 | + 51| 3|} |
112 | 89 | ------------------ |
113 | 90 | | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>: |
114 | | - | 55| 1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
115 | | - | 56| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
116 | | - | 57| 1|} |
| 91 | + | 49| 1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 92 | + | 50| 1| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 93 | + | 51| 1|} |
117 | 94 | ------------------ |
118 | 95 | | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>: |
119 | | - | 55| 2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
120 | | - | 56| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
121 | | - | 57| 2|} |
122 | | - ------------------ |
123 | | - 58| | |
124 | | - 59| |#[inline(always)] |
125 | | - 60| 0|pub fn unused_generic_function<T: Debug>(arg: T) { |
126 | | - 61| 0| println!("unused_generic_function with {:?}", arg); |
127 | | - 62| 0|} |
128 | | - 63| | |
129 | | - 64| |#[inline(always)] |
130 | | - 65| 0|pub fn unused_function() { |
131 | | - 66| 0| let is_true = std::env::args().len() == 1; |
132 | | - 67| 0| let mut countdown = 2; |
133 | | - 68| 0| if !is_true { |
134 | | - 69| 0| countdown = 20; |
135 | | - 70| 0| } |
136 | | - 71| 0|} |
137 | | - 72| | |
138 | | - 73| |#[inline(always)] |
139 | | - 74| 0|fn unused_private_function() { |
140 | | - 75| 0| let is_true = std::env::args().len() == 1; |
141 | | - 76| 0| let mut countdown = 2; |
142 | | - 77| 0| if !is_true { |
143 | | - 78| 0| countdown = 20; |
144 | | - 79| 0| } |
145 | | - 80| 0|} |
146 | | - 81| | |
147 | | - 82| 2|fn use_this_lib_crate() { |
148 | | - 83| 2| used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); |
149 | | - 84| 2| used_with_same_type_from_bin_crate_and_lib_crate_generic_function( |
150 | | - 85| 2| "used from library used_crate.rs", |
151 | | - 86| 2| ); |
152 | | - 87| 2| let some_vec = vec![5, 6, 7, 8]; |
153 | | - 88| 2| used_only_from_this_lib_crate_generic_function(some_vec); |
154 | | - 89| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); |
155 | | - 90| 2|} |
| 96 | + | 49| 2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) { |
| 97 | + | 50| 2| println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg); |
| 98 | + | 51| 2|} |
| 99 | + ------------------ |
| 100 | + 52| | |
| 101 | + 53| |#[inline(always)] |
| 102 | + 54| 0|pub fn unused_generic_function<T: Debug>(arg: T) { |
| 103 | + 55| 0| println!("unused_generic_function with {:?}", arg); |
| 104 | + 56| 0|} |
| 105 | + 57| | |
| 106 | + 58| |#[inline(always)] |
| 107 | + 59| 0|pub fn unused_function() { |
| 108 | + 60| 0| let is_true = std::env::args().len() == 1; |
| 109 | + 61| 0| let mut countdown = 2; |
| 110 | + 62| 0| if !is_true { |
| 111 | + 63| 0| countdown = 20; |
| 112 | + 64| 0| } |
| 113 | + 65| 0|} |
| 114 | + 66| | |
| 115 | + 67| |#[inline(always)] |
| 116 | + 68| 0|fn unused_private_function() { |
| 117 | + 69| 0| let is_true = std::env::args().len() == 1; |
| 118 | + 70| 0| let mut countdown = 2; |
| 119 | + 71| 0| if !is_true { |
| 120 | + 72| 0| countdown = 20; |
| 121 | + 73| 0| } |
| 122 | + 74| 0|} |
| 123 | + 75| | |
| 124 | + 76| 2|fn use_this_lib_crate() { |
| 125 | + 77| 2| used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs"); |
| 126 | + 78| 2| used_with_same_type_from_bin_crate_and_lib_crate_generic_function( |
| 127 | + 79| 2| "used from library used_crate.rs", |
| 128 | + 80| 2| ); |
| 129 | + 81| 2| let some_vec = vec![5, 6, 7, 8]; |
| 130 | + 82| 2| used_only_from_this_lib_crate_generic_function(some_vec); |
| 131 | + 83| 2| used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs"); |
| 132 | + 84| 2|} |
156 | 133 |
|
0 commit comments