summaryrefslogtreecommitdiffstats
path: root/src/test/run-make/coverage-reports/expected_show_coverage.uses_inline_crate.txt
blob: 748343885de1d42c476c6003797732806f6cf20b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
    1|       |#![allow(unused_assignments, unused_variables)]
    2|       |
    3|       |// compile-flags: -C opt-level=3 # validates coverage now works with optimizations
    4|       |
    5|       |use std::fmt::Debug;
    6|       |
    7|      1|pub fn used_function() {
    8|      1|    // Initialize test constants in a way that cannot be determined at compile time, to ensure
    9|      1|    // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
   10|      1|    // dependent conditions.
   11|      1|    let is_true = std::env::args().len() == 1;
   12|      1|    let mut countdown = 0;
   13|      1|    if is_true {
   14|      1|        countdown = 10;
   15|      1|    }
                   ^0
   16|      1|    use_this_lib_crate();
   17|      1|}
   18|       |
   19|       |#[inline(always)]
   20|      1|pub fn used_inline_function() {
   21|      1|    // Initialize test constants in a way that cannot be determined at compile time, to ensure
   22|      1|    // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
   23|      1|    // dependent conditions.
   24|      1|    let is_true = std::env::args().len() == 1;
   25|      1|    let mut countdown = 0;
   26|      1|    if is_true {
   27|      1|        countdown = 10;
   28|      1|    }
                   ^0
   29|      1|    use_this_lib_crate();
   30|      1|}
   31|       |
   32|       |
   33|       |
   34|       |
   35|       |
   36|       |
   37|       |
   38|       |#[inline(always)]
   39|      2|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
   40|      2|    println!("used_only_from_bin_crate_generic_function with {:?}", arg);
   41|      2|}
  ------------------
  | used_inline_crate::used_only_from_bin_crate_generic_function::<&alloc::vec::Vec<i32>>:
  |   39|      1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
  |   40|      1|    println!("used_only_from_bin_crate_generic_function with {:?}", arg);
  |   41|      1|}
  ------------------
  | used_inline_crate::used_only_from_bin_crate_generic_function::<&str>:
  |   39|      1|pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) {
  |   40|      1|    println!("used_only_from_bin_crate_generic_function with {:?}", arg);
  |   41|      1|}
  ------------------
  | Unexecuted instantiation: used_inline_crate::used_only_from_bin_crate_generic_function::<_>
  ------------------
   42|       |// Expect for above function: `Unexecuted instantiation` (see notes in `used_crate.rs`)
   43|       |
   44|       |#[inline(always)]
   45|      4|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
   46|      4|    println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
   47|      4|}
  ------------------
  | used_inline_crate::used_only_from_this_lib_crate_generic_function::<&str>:
  |   45|      2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
  |   46|      2|    println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
  |   47|      2|}
  ------------------
  | used_inline_crate::used_only_from_this_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
  |   45|      2|pub fn used_only_from_this_lib_crate_generic_function<T: Debug>(arg: T) {
  |   46|      2|    println!("used_only_from_this_lib_crate_generic_function with {:?}", arg);
  |   47|      2|}
  ------------------
   48|       |
   49|       |#[inline(always)]
   50|      3|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
   51|      3|    println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
   52|      3|}
  ------------------
  | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<alloc::vec::Vec<i32>>:
  |   50|      1|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
  |   51|      1|    println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
  |   52|      1|}
  ------------------
  | used_inline_crate::used_from_bin_crate_and_lib_crate_generic_function::<&str>:
  |   50|      2|pub fn used_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
  |   51|      2|    println!("used_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
  |   52|      2|}
  ------------------
   53|       |
   54|       |#[inline(always)]
   55|      3|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
   56|      3|    println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
   57|      3|}
  ------------------
  | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
  |   55|      1|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
  |   56|      1|    println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
  |   57|      1|}
  ------------------
  | used_inline_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function::<&str>:
  |   55|      2|pub fn used_with_same_type_from_bin_crate_and_lib_crate_generic_function<T: Debug>(arg: T) {
  |   56|      2|    println!("used_with_same_type_from_bin_crate_and_lib_crate_generic_function with {:?}", arg);
  |   57|      2|}
  ------------------
   58|       |
   59|       |#[inline(always)]
   60|      0|pub fn unused_generic_function<T: Debug>(arg: T) {
   61|      0|    println!("unused_generic_function with {:?}", arg);
   62|      0|}
   63|       |
   64|       |#[inline(always)]
   65|      0|pub fn unused_function() {
   66|      0|    let is_true = std::env::args().len() == 1;
   67|      0|    let mut countdown = 2;
   68|      0|    if !is_true {
   69|      0|        countdown = 20;
   70|      0|    }
   71|      0|}
   72|       |
   73|       |#[inline(always)]
   74|      0|fn unused_private_function() {
   75|      0|    let is_true = std::env::args().len() == 1;
   76|      0|    let mut countdown = 2;
   77|      0|    if !is_true {
   78|      0|        countdown = 20;
   79|      0|    }
   80|      0|}
   81|       |
   82|      2|fn use_this_lib_crate() {
   83|      2|    used_from_bin_crate_and_lib_crate_generic_function("used from library used_crate.rs");
   84|      2|    used_with_same_type_from_bin_crate_and_lib_crate_generic_function(
   85|      2|        "used from library used_crate.rs",
   86|      2|    );
   87|      2|    let some_vec = vec![5, 6, 7, 8];
   88|      2|    used_only_from_this_lib_crate_generic_function(some_vec);
   89|      2|    used_only_from_this_lib_crate_generic_function("used ONLY from library used_crate.rs");
   90|      2|}