Skip to content

Commit 4da38c3

Browse files
committed
Tidy up some awkwardly-placed comments in tests
Prior to rust-lang#114875, these tests were very sensitive to lines being added/removed, so the migration to `run-coverage` in rust-lang#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.
1 parent 72b721f commit 4da38c3

10 files changed

+30
-10
lines changed

tests/run-coverage-rustdoc/doctest.coverage

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ $DIR/auxiliary/doctest_crate.rs:
1010
LL| 3|}
1111

1212
$DIR/doctest.rs:
13+
LL| |// aux-build:doctest_crate.rs
14+
LL| |
1315
LL| |//! This test ensures that code from doctests is properly re-mapped.
1416
LL| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
1517
LL| |//!
@@ -78,7 +80,7 @@ $DIR/doctest.rs:
7880
LL| |//! doctest_main()
7981
LL| |//! }
8082
LL| |//! ```
81-
LL| |// aux-build:doctest_crate.rs
83+
LL| |
8284
LL| |/// doctest attached to fn testing external code:
8385
LL| |/// ```
8486
LL| 1|/// extern crate doctest_crate;

tests/run-coverage-rustdoc/doctest.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// aux-build:doctest_crate.rs
2+
13
//! This test ensures that code from doctests is properly re-mapped.
24
//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
35
//!
@@ -63,7 +65,7 @@
6365
//! doctest_main()
6466
//! }
6567
//! ```
66-
// aux-build:doctest_crate.rs
68+
6769
/// doctest attached to fn testing external code:
6870
/// ```
6971
/// extern crate doctest_crate;

tests/run-coverage/auxiliary/used_crate.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![allow(unused_assignments, unused_variables)]
2+
// Verify that coverage works with optimizations:
23
// compile-flags: -C opt-level=3
3-
use std::fmt::Debug; // ^^ validates coverage now works with optimizations
4+
5+
use std::fmt::Debug;
46

57
pub fn used_function() {
68
// Initialize test constants in a way that cannot be determined at compile time, to ensure

tests/run-coverage/auxiliary/used_inline_crate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unused_assignments, unused_variables)]
2-
2+
// Verify that coverage works with optimizations:
33
// compile-flags: -C opt-level=3
4-
// ^^ validates coverage now works with optimizations
4+
55
use std::fmt::Debug;
66

77
pub fn used_function() {

tests/run-coverage/closure.coverage

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
LL| |#![allow(unused_assignments, unused_variables)]
22
LL| |// compile-flags: -C opt-level=2
3-
LL| 1|fn main() { // ^^ fix described in rustc_middle/mir/mono.rs
3+
LL| |
4+
LL| |// This test used to be sensitive to certain coverage-specific hacks in
5+
LL| |// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
6+
LL| |// <https://github.com/rust-lang/rust/pull/83666>.
7+
LL| |
8+
LL| 1|fn main() {
49
LL| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure
510
LL| 1| // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
611
LL| 1| // dependent conditions.

tests/run-coverage/closure.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#![allow(unused_assignments, unused_variables)]
22
// compile-flags: -C opt-level=2
3-
fn main() { // ^^ fix described in rustc_middle/mir/mono.rs
3+
4+
// This test used to be sensitive to certain coverage-specific hacks in
5+
// `rustc_middle/mir/mono.rs`, but those hacks were later cleaned up by
6+
// <https://github.com/rust-lang/rust/pull/83666>.
7+
8+
fn main() {
49
// Initialize test constants in a way that cannot be determined at compile time, to ensure
510
// rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
611
// dependent conditions.

tests/run-coverage/issue-85461.coverage

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
2424

2525
$DIR/issue-85461.rs:
2626
LL| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
27+
LL| |
2728
LL| |// aux-build:inline_always_with_dead_code.rs
2829
LL| |extern crate inline_always_with_dead_code;
2930
LL| |

tests/run-coverage/issue-85461.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
2+
23
// aux-build:inline_always_with_dead_code.rs
34
extern crate inline_always_with_dead_code;
45

tests/run-coverage/uses_crate.coverage

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
$DIR/auxiliary/used_crate.rs:
22
LL| |#![allow(unused_assignments, unused_variables)]
3+
LL| |// Verify that coverage works with optimizations:
34
LL| |// compile-flags: -C opt-level=3
4-
LL| |use std::fmt::Debug; // ^^ validates coverage now works with optimizations
5+
LL| |
6+
LL| |use std::fmt::Debug;
57
LL| |
68
LL| 1|pub fn used_function() {
79
LL| 1| // Initialize test constants in a way that cannot be determined at compile time, to ensure

tests/run-coverage/uses_inline_crate.coverage

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
$DIR/auxiliary/used_inline_crate.rs:
22
LL| |#![allow(unused_assignments, unused_variables)]
3-
LL| |
3+
LL| |// Verify that coverage works with optimizations:
44
LL| |// compile-flags: -C opt-level=3
5-
LL| |// ^^ validates coverage now works with optimizations
5+
LL| |
66
LL| |use std::fmt::Debug;
77
LL| |
88
LL| 1|pub fn used_function() {

0 commit comments

Comments
 (0)