]> git.lizzy.rs Git - rust.git/blob - tests/run-make/coverage-reports/expected_show_coverage.inline.txt
Rollup merge of #103236 - tspiteri:redoc-int-adc-sbb, r=m-ou-se
[rust.git] / tests / run-make / coverage-reports / expected_show_coverage.inline.txt
1     1|       |// compile-flags: -Zinline-mir
2     2|       |
3     3|       |use std::fmt::Display;
4     4|       |
5     5|      1|fn main() {
6     6|      1|    permutations(&['a', 'b', 'c']);
7     7|      1|}
8     8|       |
9     9|       |#[inline(always)]
10    10|      1|fn permutations<T: Copy + Display>(xs: &[T]) {
11    11|      1|    let mut ys = xs.to_owned();
12    12|      1|    permutate(&mut ys, 0);
13    13|      1|}
14    14|       |
15    15|     16|fn permutate<T: Copy + Display>(xs: &mut [T], k: usize) {
16    16|     16|    let n = length(xs);
17    17|     16|    if k == n {
18    18|      6|        display(xs);
19    19|     10|    } else if k < n {
20    20|     15|        for i in k..n {
21                                ^10
22    21|     15|            swap(xs, i, k);
23    22|     15|            permutate(xs, k + 1);
24    23|     15|            swap(xs, i, k);
25    24|     15|        }
26    25|      0|    } else {
27    26|      0|        error();
28    27|      0|    }
29    28|     16|}
30    29|       |
31    30|     16|fn length<T>(xs: &[T]) -> usize {
32    31|     16|    xs.len()
33    32|     16|}
34    33|       |
35    34|       |#[inline]
36    35|     30|fn swap<T: Copy>(xs: &mut [T], i: usize, j: usize) {
37    36|     30|    let t = xs[i];
38    37|     30|    xs[i] = xs[j];
39    38|     30|    xs[j] = t;
40    39|     30|}
41    40|       |
42    41|      6|fn display<T: Display>(xs: &[T]) {
43    42|     24|    for x in xs {
44                       ^18
45    43|     18|        print!("{}", x);
46    44|     18|    }
47    45|      6|    println!();
48    46|      6|}
49    47|       |
50    48|       |#[inline(always)]
51    49|      0|fn error() {
52    50|      0|    panic!("error");
53    51|      0|}
54