    1|       |// This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
    2|       |// structure of this test.
    3|       |
    4|      2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
                                                    ^1       ^1
  ------------------
  | Unexecuted instantiation: <partial_eq::Version as core::cmp::PartialOrd>::gt
  ------------------
  | Unexecuted instantiation: <partial_eq::Version as core::cmp::PartialOrd>::le
  ------------------
  | Unexecuted instantiation: <partial_eq::Version as core::cmp::PartialOrd>::ge
  ------------------
  | <partial_eq::Version as core::cmp::PartialOrd>::lt:
  |    4|      1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
  ------------------
    5|       |pub struct Version {
    6|       |    major: usize,
    7|      1|    minor: usize,
    8|       |    patch: usize,
    9|       |}
   10|       |
   11|       |impl Version {
   12|       |    pub fn new(major: usize, minor: usize, patch: usize) -> Self {
   13|      2|        Self {
   14|      2|            major,
   15|      2|            minor,
   16|      2|            patch,
   17|      2|        }
   18|      2|    }
   19|       |}
   20|       |
   21|      1|fn main() {
   22|      1|    let version_3_2_1 = Version::new(3, 2, 1);
   23|      1|    let version_3_3_0 = Version::new(3, 3, 0);
   24|      1|
   25|      1|    println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version_3_3_0);
   26|      1|}
   27|       |
   28|       |/*
   29|       |
   30|       |This test verifies a bug was fixed that otherwise generated this error:
   31|       |
   32|       |thread 'rustc' panicked at 'No counters provided the source_hash for function:
   33|       |    Instance {
   34|       |        def: Item(WithOptConstParam {
   35|       |            did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp),
   36|       |            const_param_did: None
   37|       |        }),
   38|       |        substs: []
   39|       |    }'
   40|       |The `PartialOrd` derived by `Version` happened to generate a MIR that generated coverage
   41|       |without a code region associated with any `Counter`. Code regions were associated with at least
   42|       |one expression, which is allowed, but the `function_source_hash` was only passed to the codegen
   43|       |(coverage mapgen) phase from a `Counter`s code region. A new method was added to pass the
   44|       |`function_source_hash` without a code region, if necessary.
   45|       |
   46|       |*/
   47|       |
   48|       |// FIXME(richkadel): It may be worth investigating why the coverage report for this test produces
   49|       |// the following results:
   50|       |
   51|       |/*
   52|       |
   53|       |1. Why are their two counts below different characters (first and last) of `PartialOrd`, on line 17?
   54|       |
   55|       |2. Line 17 is counted twice, but the `::lt` instance shows a line count of 1? Is there a missing
   56|       |   line count with a different instance? Or was it really only called once?
   57|       |
   58|       |3. Line 20 shows another line count (of 1) for a line within a `struct` declaration (on only one of
   59|       |   its 3 fields). I doubt the specific field (`minor`) is relevant, but rather I suspect there's a
   60|       |   problem computing the file position here, for some reason.
   61|       |
   62|       |<snip>
   63|       |   16|       |
   64|       |   17|      2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
   65|       |                                                    ^1       ^1
   66|       |------------------
   67|       ||Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::gt
   68|       |------------------
   69|       ||Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::le
   70|       |------------------
   71|       ||Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::ge
   72|       |------------------
   73|       ||<partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::lt:
   74|       ||  17|      1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
   75|       |------------------
   76|       |   18|       |pub struct Version {
   77|       |   19|       |    major: usize,
   78|       |   20|      1|    minor: usize,
   79|       |   21|       |    patch: usize,
   80|       |   22|       |}
   81|       |   23|       |
   82|       |   24|       |impl Version {
   83|       |   25|       |    pub fn new(major: usize, minor: usize, patch: usize) -> Self {
   84|       |   26|      2|        Version {
   85|       |   27|      2|            major,
   86|       |   28|      2|            minor,
   87|       |   29|      2|            patch,
   88|       |   30|      2|        }
   89|       |   31|      2|    }
   90|       |   32|       |}
   91|       |   33|       |
   92|       |   34|      1|fn main() {
   93|       |   35|      1|    let version_3_2_1 = Version::new(3, 2, 1);
   94|       |   36|      1|    let version_3_3_0 = Version::new(3, 3, 0);
   95|       |   37|      1|
   96|       |   38|      1|    println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version
   97|       |_3_3_0);
   98|       |   39|      1|}
   99|       |*/

