]>
git.proxmox.com Git - rustc.git/blob - src/test/run-make-fulldeps/coverage/partial_eq.rs
1 // This test confirms an earlier problem was resolved, supporting the MIR graph generated by the
2 // structure of this test.
4 #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
12 pub fn new(major
: usize, minor
: usize, patch
: usize) -> Self {
22 let version_3_2_1
= Version
::new(3, 2, 1);
23 let version_3_3_0
= Version
::new(3, 3, 0);
25 println
!("{:?} < {:?} = {}", version_3_2_1
, version_3_3_0
, version_3_2_1
< version_3_3_0
);
30 This test verifies a bug was fixed that otherwise generated this error:
32 thread 'rustc' panicked at 'No counters provided the source_hash for function:
34 def: Item(WithOptConstParam {
35 did: DefId(0:101 ~ autocfg[c44a]::version::{impl#2}::partial_cmp),
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.
48 // FIXME(richkadel): It may be worth investigating why the coverage report for this test produces
49 // the following results:
53 1. Why are their two counts below different characters (first and last) of `PartialOrd`, on line 17?
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?
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.
64 17| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
67 |Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::gt
69 |Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::le
71 |Unexecuted instantiation: <partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::ge
73 |<partial_eq_counter_without_region::Version as core::cmp::PartialOrd>::lt:
74 | 17| 1|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
76 18| |pub struct Version {
83 25| | pub fn new(major: usize, minor: usize, patch: usize) -> Self {
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);
96 38| 1| println!("{:?} < {:?} = {}", version_3_2_1, version_3_3_0, version_3_2_1 < version