fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB49 linesraw
1   LL|       |// compile-flags: --edition=2021
2   LL|       |
3   LL|       |// Demonstrate that `sort_subviews.py` can sort instantiation groups into a
4   LL|       |// predictable order, while preserving their heterogeneous contents.
5   LL|       |
6   LL|      1|fn main() {
7   LL|      1|    let cond = std::env::args().len() > 1;
8   LL|      1|    generic_fn::<()>(cond);
9   LL|      1|    generic_fn::<&'static str>(!cond);
10   LL|      1|    if false {
11   LL|      0|        generic_fn::<char>(cond);
12   LL|      1|    }
13   LL|      1|    generic_fn::<i32>(cond);
14   LL|      1|    other_fn();
15   LL|      1|}
16   LL|       |
17   LL|      3|fn generic_fn<T>(cond: bool) {
18   LL|      3|    if cond {
19   LL|      1|        println!("{}", std::any::type_name::<T>());
20   LL|      2|    }
21   LL|      3|}
22  ------------------
23  | Unexecuted instantiation: sort_groups::generic_fn::<char>
24  ------------------
25  | sort_groups::generic_fn::<&str>:
26  |   LL|      1|fn generic_fn<T>(cond: bool) {
27  |   LL|      1|    if cond {
28  |   LL|      1|        println!("{}", std::any::type_name::<T>());
29  |   LL|      1|    }
30  |                   ^0
31  |   LL|      1|}
32  ------------------
33  | sort_groups::generic_fn::<()>:
34  |   LL|      1|fn generic_fn<T>(cond: bool) {
35  |   LL|      1|    if cond {
36  |   LL|      0|        println!("{}", std::any::type_name::<T>());
37  |   LL|      1|    }
38  |   LL|      1|}
39  ------------------
40  | sort_groups::generic_fn::<i32>:
41  |   LL|      1|fn generic_fn<T>(cond: bool) {
42  |   LL|      1|    if cond {
43  |   LL|      0|        println!("{}", std::any::type_name::<T>());
44  |   LL|      1|    }
45  |   LL|      1|}
46  ------------------
47   LL|       |
48   LL|      1|fn other_fn() {}
49