Resolve all warnings in run-coverage
tests
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`.)
This commit is contained in:
parent
9334ec9354
commit
72b721f48e
@ -1,11 +1,5 @@
|
||||
LL| |// compile-flags: --edition=2018
|
||||
LL| |
|
||||
LL| |use core::{
|
||||
LL| | future::Future,
|
||||
LL| | marker::Send,
|
||||
LL| | pin::Pin,
|
||||
LL| |};
|
||||
LL| |
|
||||
LL| 1|fn non_async_func() {
|
||||
LL| 1| println!("non_async_func was covered");
|
||||
LL| 1| let b = true;
|
||||
|
@ -1,11 +1,5 @@
|
||||
// compile-flags: --edition=2018
|
||||
|
||||
use core::{
|
||||
future::Future,
|
||||
marker::Send,
|
||||
pin::Pin,
|
||||
};
|
||||
|
||||
fn non_async_func() {
|
||||
println!("non_async_func was covered");
|
||||
let b = true;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#[allow(dead_code)]
|
||||
pub fn never_called_function() {
|
||||
println!("I am never called");
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ pub fn unused_function() {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn unused_private_function() {
|
||||
let is_true = std::env::args().len() == 1;
|
||||
let mut countdown = 2;
|
||||
|
@ -71,6 +71,7 @@ pub fn unused_function() {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(dead_code)]
|
||||
fn unused_private_function() {
|
||||
let is_true = std::env::args().len() == 1;
|
||||
let mut countdown = 2;
|
||||
|
@ -42,7 +42,7 @@
|
||||
LL| |
|
||||
LL| |#[no_coverage]
|
||||
LL| |fn main() {
|
||||
LL| | executor::block_on(test());
|
||||
LL| | executor::block_on(test()).unwrap();
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |mod executor {
|
||||
|
@ -41,7 +41,7 @@ pub async fn test() -> Result<(), String> {
|
||||
|
||||
#[no_coverage]
|
||||
fn main() {
|
||||
executor::block_on(test());
|
||||
executor::block_on(test()).unwrap();
|
||||
}
|
||||
|
||||
mod executor {
|
||||
|
@ -1,4 +1,4 @@
|
||||
LL| |#![allow(unused_assignments, unused_variables)]
|
||||
LL| |#![allow(dead_code, unused_assignments, unused_variables)]
|
||||
LL| |
|
||||
LL| 0|pub fn unused_pub_fn_not_in_library() {
|
||||
LL| 0| // Initialize test constants in a way that cannot be determined at compile time, to ensure
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused_assignments, unused_variables)]
|
||||
#![allow(dead_code, unused_assignments, unused_variables)]
|
||||
|
||||
pub fn unused_pub_fn_not_in_library() {
|
||||
// Initialize test constants in a way that cannot be determined at compile time, to ensure
|
||||
|
@ -1,3 +1,5 @@
|
||||
LL| |#![allow(dead_code, unreachable_code)]
|
||||
LL| |
|
||||
LL| |// Regression test for #93054: Functions using uninhabited types often only have a single,
|
||||
LL| |// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
|
||||
LL| |// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(dead_code, unreachable_code)]
|
||||
|
||||
// Regression test for #93054: Functions using uninhabited types often only have a single,
|
||||
// unreachable basic block which doesn't get instrumented. This should not cause llvm-cov to fail.
|
||||
// Since these kinds functions can't be invoked anyway, it's ok to not have coverage data for them.
|
||||
|
@ -1,5 +1,3 @@
|
||||
LL| |#![feature(or_patterns)]
|
||||
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
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![feature(or_patterns)]
|
||||
|
||||
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
|
||||
|
@ -12,6 +12,7 @@
|
||||
LL| |}
|
||||
LL| |
|
||||
LL| |#[no_coverage]
|
||||
LL| |#[allow(dead_code)]
|
||||
LL| |fn do_not_add_coverage_not_called() {
|
||||
LL| | println!("not called and not covered");
|
||||
LL| |}
|
||||
@ -24,6 +25,7 @@
|
||||
LL| 1| println!("called and covered");
|
||||
LL| 1|}
|
||||
LL| |
|
||||
LL| |#[allow(dead_code)]
|
||||
LL| 0|fn add_coverage_not_called() {
|
||||
LL| 0| println!("not called but covered");
|
||||
LL| 0|}
|
||||
|
@ -12,6 +12,7 @@ fn do_not_add_coverage_2() {
|
||||
}
|
||||
|
||||
#[no_coverage]
|
||||
#[allow(dead_code)]
|
||||
fn do_not_add_coverage_not_called() {
|
||||
println!("not called and not covered");
|
||||
}
|
||||
@ -24,6 +25,7 @@ fn add_coverage_2() {
|
||||
println!("called and covered");
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn add_coverage_not_called() {
|
||||
println!("not called but covered");
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
LL| |#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
|
||||
LL| |
|
||||
LL| 2|fn foo<T>(x: T) {
|
||||
LL| 2| let mut i = 0;
|
||||
LL| 22| while i < 10 {
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(dead_code, unused_assignments, unused_must_use, unused_variables)]
|
||||
|
||||
fn foo<T>(x: T) {
|
||||
let mut i = 0;
|
||||
while i < 10 {
|
||||
|
@ -1,4 +1,5 @@
|
||||
$DIR/auxiliary/unused_mod_helper.rs:
|
||||
LL| |#[allow(dead_code)]
|
||||
LL| 0|pub fn never_called_function() {
|
||||
LL| 0| println!("I am never called");
|
||||
LL| 0|}
|
||||
|
@ -90,6 +90,7 @@ $DIR/auxiliary/used_crate.rs:
|
||||
LL| 0| }
|
||||
LL| 0|}
|
||||
LL| |
|
||||
LL| |#[allow(dead_code)]
|
||||
LL| 0|fn unused_private_function() {
|
||||
LL| 0| let is_true = std::env::args().len() == 1;
|
||||
LL| 0| let mut countdown = 2;
|
||||
|
@ -120,6 +120,7 @@ $DIR/auxiliary/used_inline_crate.rs:
|
||||
LL| 0|}
|
||||
LL| |
|
||||
LL| |#[inline(always)]
|
||||
LL| |#[allow(dead_code)]
|
||||
LL| 0|fn unused_private_function() {
|
||||
LL| 0| let is_true = std::env::args().len() == 1;
|
||||
LL| 0| let mut countdown = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user