diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-02-19 00:56:54 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-02-19 13:56:20 +1100 |
| commit | d9b91de00c3716e577aeb02929bee69f8028f3a0 (patch) | |
| tree | 07968b88429f37080cb4046f6561991003fa94c4 /tests/coverage/holes.rs | |
| parent | f44efbf9e11b1b6bba77c046d7dd150de37e0e0f (diff) | |
| download | rust-d9b91de00c3716e577aeb02929bee69f8028f3a0.tar.gz rust-d9b91de00c3716e577aeb02929bee69f8028f3a0.zip | |
coverage: Add some more cases to `tests/coverage/holes.rs`
Diffstat (limited to 'tests/coverage/holes.rs')
| -rw-r--r-- | tests/coverage/holes.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/coverage/holes.rs b/tests/coverage/holes.rs index b3a71e759c8..7f6671772c3 100644 --- a/tests/coverage/holes.rs +++ b/tests/coverage/holes.rs @@ -8,6 +8,12 @@ use core::hint::black_box; fn main() { black_box(()); + static MY_STATIC: () = (); + + black_box(()); + + const MY_CONST: () = (); + // Splitting this across multiple lines makes it easier to see where the // coverage mapping regions begin and end. #[rustfmt::skip] @@ -39,6 +45,14 @@ fn main() { black_box(()); + trait MyTrait {} + + black_box(()); + + impl MyTrait for MyStruct {} + + black_box(()); + macro_rules! _my_macro { () => {}; } @@ -64,4 +78,23 @@ fn main() { ; black_box(()); + + // This tests the edge case of a const block nested inside an "anon const", + // such as the length of an array literal. Handling this case requires + // `nested_filter::OnlyBodies` or equivalent. + #[rustfmt::skip] + let _const_block_inside_anon_const = + [ + 0 + ; + 7 + + + const + { + 3 + } + ] + ; + + black_box(()); } |
