This code was calling `sort_unstable_by`, but failed to impose a total order on
the initial spans. That resulted in unpredictable handling of closure spans,
producing inconsistencies in the coverage maps and in user-visible coverage
reports.
This patch fixes the problem by always sorting closure spans before
otherwise-identical non-closure spans, and also switches to a stable sort in
case the ordering is still not total.
These changes were made by manually running `rustfmt` on all of the test files,
and then manually undoing all cases where the original formatting appeared to
have been deliberate.
`rustfmt +nightly --config-path=/dev/null --edition=2021 tests/run-coverage*/**/*.rs`
Prior to #114875, these tests were very sensitive to lines being added/removed,
so the migration to `run-coverage` in #112300 tried hard to avoid disturbing
the existing line numbers. That resulted in some awkward reshuffling when
certain comments/directives needed to be added or moved.
Now that we don't have to worry about preserving line numbers, we can rearrange
those comments into a more conventional layout.
When one of these tests fails, any compiler warnings will be printed to the
console, which makes it harder to track down the actual reason for failure.
(The outstanding warnings were found by temporarily adding `-Dwarnings` to the
compiler arguments for `RunCoverage` in `src/tools/compiletest/src/runtest.rs`.)
To make it easier to verify that the output snapshots have been migrated
faithfully, this change adds some temporary helper code that lets us avoid
having to completely re-bless the existing snapshots.
A later change in this PR will then re-bless the tests and remove the temporary
helper code.