Tidy up some awkwardly-placed comments in tests

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.
This commit is contained in:
Zalathar 2023-08-17 11:32:33 +10:00
parent 72b721f48e
commit 4da38c31d2
10 changed files with 30 additions and 10 deletions

View File

@ -10,6 +10,8 @@ $DIR/auxiliary/doctest_crate.rs:
LL| 3|}
$DIR/doctest.rs:
LL| |// aux-build:doctest_crate.rs
LL| |
LL| |//! This test ensures that code from doctests is properly re-mapped.
LL| |//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
LL| |//!
@ -78,7 +80,7 @@ $DIR/doctest.rs:
LL| |//! doctest_main()
LL| |//! }
LL| |//! ```
LL| |// aux-build:doctest_crate.rs
LL| |
LL| |/// doctest attached to fn testing external code:
LL| |/// ```
LL| 1|/// extern crate doctest_crate;

View File

@ -1,3 +1,5 @@
// aux-build:doctest_crate.rs
//! This test ensures that code from doctests is properly re-mapped.
//! See <https://github.com/rust-lang/rust/issues/79417> for more info.
//!
@ -63,7 +65,7 @@
//! doctest_main()
//! }
//! ```
// aux-build:doctest_crate.rs
/// doctest attached to fn testing external code:
/// ```
/// extern crate doctest_crate;

View File

@ -1,6 +1,8 @@
#![allow(unused_assignments, unused_variables)]
// Verify that coverage works with optimizations:
// compile-flags: -C opt-level=3
use std::fmt::Debug; // ^^ validates coverage now works with optimizations
use std::fmt::Debug;
pub fn used_function() {
// Initialize test constants in a way that cannot be determined at compile time, to ensure

View File

@ -1,7 +1,7 @@
#![allow(unused_assignments, unused_variables)]
// Verify that coverage works with optimizations:
// compile-flags: -C opt-level=3
// ^^ validates coverage now works with optimizations
use std::fmt::Debug;
pub fn used_function() {

View File

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

View File

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

View File

@ -24,6 +24,7 @@ $DIR/auxiliary/inline_always_with_dead_code.rs:
$DIR/issue-85461.rs:
LL| |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
LL| |
LL| |// aux-build:inline_always_with_dead_code.rs
LL| |extern crate inline_always_with_dead_code;
LL| |

View File

@ -1,4 +1,5 @@
// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
// aux-build:inline_always_with_dead_code.rs
extern crate inline_always_with_dead_code;

View File

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

View File

@ -1,8 +1,8 @@
$DIR/auxiliary/used_inline_crate.rs:
LL| |#![allow(unused_assignments, unused_variables)]
LL| |
LL| |// Verify that coverage works with optimizations:
LL| |// compile-flags: -C opt-level=3
LL| |// ^^ validates coverage now works with optimizations
LL| |
LL| |use std::fmt::Debug;
LL| |
LL| 1|pub fn used_function() {