summaryrefslogtreecommitdiffstats
path: root/tests/run-coverage/partial_eq.coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/run-coverage/partial_eq.coverage
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-coverage/partial_eq.coverage')
-rw-r--r--tests/run-coverage/partial_eq.coverage48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/run-coverage/partial_eq.coverage b/tests/run-coverage/partial_eq.coverage
new file mode 100644
index 000000000..a77175af6
--- /dev/null
+++ b/tests/run-coverage/partial_eq.coverage
@@ -0,0 +1,48 @@
+ 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)]
+ ^0 ^0 ^0 ^1 ^1 ^0^0
+ 5| |pub struct Version {
+ 6| | major: usize,
+ 7| | minor: usize,
+ 8| | patch: usize,
+ 9| |}
+ 10| |
+ 11| |impl Version {
+ 12| 2| 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| |*/
+