diff options
Diffstat (limited to '')
5 files changed, 20 insertions, 11 deletions
diff --git a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs index 2b21dee6c..9dc50dae2 100644 --- a/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs +++ b/tests/run-coverage/auxiliary/inline_always_with_dead_code.rs @@ -4,9 +4,9 @@ mod foo { #[inline(always)] - pub fn called() { } + pub fn called() {} - fn uncalled() { } + fn uncalled() {} } pub mod bar { diff --git a/tests/run-coverage/auxiliary/macro_name_span_helper.rs b/tests/run-coverage/auxiliary/macro_name_span_helper.rs new file mode 100644 index 000000000..6797c081d --- /dev/null +++ b/tests/run-coverage/auxiliary/macro_name_span_helper.rs @@ -0,0 +1,10 @@ +// edition: 2021 + +#[macro_export] +macro_rules! macro_that_defines_a_function { + (fn $name:ident () $body:tt) => { + fn $name () -> () $body + } +} + +// Non-executable comment. diff --git a/tests/run-coverage/auxiliary/unused_mod_helper.rs b/tests/run-coverage/auxiliary/unused_mod_helper.rs index ae1cc1531..88c5dac65 100644 --- a/tests/run-coverage/auxiliary/unused_mod_helper.rs +++ b/tests/run-coverage/auxiliary/unused_mod_helper.rs @@ -1,3 +1,4 @@ +#[allow(dead_code)] pub fn never_called_function() { println!("I am never called"); } diff --git a/tests/run-coverage/auxiliary/used_crate.rs b/tests/run-coverage/auxiliary/used_crate.rs index 16592d48d..c086ef21e 100644 --- a/tests/run-coverage/auxiliary/used_crate.rs +++ b/tests/run-coverage/auxiliary/used_crate.rs @@ -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 @@ -42,6 +44,7 @@ pub fn unused_function() { } } +#[allow(dead_code)] fn unused_private_function() { let is_true = std::env::args().len() == 1; let mut countdown = 2; diff --git a/tests/run-coverage/auxiliary/used_inline_crate.rs b/tests/run-coverage/auxiliary/used_inline_crate.rs index 8b8e9d548..e8929de6b 100644 --- a/tests/run-coverage/auxiliary/used_inline_crate.rs +++ b/tests/run-coverage/auxiliary/used_inline_crate.rs @@ -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() { @@ -29,12 +29,6 @@ pub fn used_inline_function() { use_this_lib_crate(); } - - - - - - #[inline(always)] pub fn used_only_from_bin_crate_generic_function<T: Debug>(arg: T) { println!("used_only_from_bin_crate_generic_function with {:?}", arg); @@ -71,6 +65,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; |