Skip to content

Commit d780a03

Browse files
committed
coverage: Tests for except-unused-generics and except-unused-functions
1 parent 4a0cc88 commit d780a03

7 files changed

+191
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Function name: except_unused::unused_fn (unused)
2+
Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 01, 02, 02]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 0
6+
Number of file 0 mappings: 1
7+
- Code(Zero) at (prev + 21, 1) to (start + 2, 2)
8+
9+
Function name: except_unused::unused_generic::<_> (unused)
10+
Raw bytes (9): 0x[01, 01, 00, 01, 00, 0d, 01, 02, 02]
11+
Number of files: 1
12+
- file 0 => global file 1
13+
Number of expressions: 0
14+
Number of file 0 mappings: 1
15+
- Code(Zero) at (prev + 13, 1) to (start + 2, 2)
16+
17+
Function name: except_unused::used_fn
18+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
19+
Number of files: 1
20+
- file 0 => global file 1
21+
Number of expressions: 0
22+
Number of file 0 mappings: 1
23+
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)
24+
25+
Function name: except_unused::used_generic::<u32>
26+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
27+
Number of files: 1
28+
- file 0 => global file 1
29+
Number of expressions: 0
30+
Number of file 0 mappings: 1
31+
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
LL| |#![feature(coverage_attribute)]
2+
LL| |#![allow(dead_code)]
3+
LL| |
4+
LL| |//@ edition: 2021
5+
LL| |//@ revisions: default functions generics
6+
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
7+
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
8+
LL| |
9+
LL| 1|fn used_generic<T>(_x: T) {
10+
LL| 1| println!("used_generic");
11+
LL| 1|}
12+
LL| |
13+
LL| 0|fn unused_generic<T>(_x: T) {
14+
LL| 0| println!("unused_generic");
15+
LL| 0|}
16+
LL| |
17+
LL| 1|fn used_fn() {
18+
LL| 1| println!("used_fn");
19+
LL| 1|}
20+
LL| |
21+
LL| 0|fn unused_fn() {
22+
LL| 0| println!("unused_fn");
23+
LL| 0|}
24+
LL| |
25+
LL| |#[coverage(off)]
26+
LL| |fn main() {
27+
LL| | used_generic(0u32);
28+
LL| | used_fn();
29+
LL| |}
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Function name: except_unused::used_fn
2+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 0
6+
Number of file 0 mappings: 1
7+
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)
8+
9+
Function name: except_unused::used_generic::<u32>
10+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
11+
Number of files: 1
12+
- file 0 => global file 1
13+
Number of expressions: 0
14+
Number of file 0 mappings: 1
15+
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
LL| |#![feature(coverage_attribute)]
2+
LL| |#![allow(dead_code)]
3+
LL| |
4+
LL| |//@ edition: 2021
5+
LL| |//@ revisions: default functions generics
6+
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
7+
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
8+
LL| |
9+
LL| 1|fn used_generic<T>(_x: T) {
10+
LL| 1| println!("used_generic");
11+
LL| 1|}
12+
LL| |
13+
LL| |fn unused_generic<T>(_x: T) {
14+
LL| | println!("unused_generic");
15+
LL| |}
16+
LL| |
17+
LL| 1|fn used_fn() {
18+
LL| 1| println!("used_fn");
19+
LL| 1|}
20+
LL| |
21+
LL| |fn unused_fn() {
22+
LL| | println!("unused_fn");
23+
LL| |}
24+
LL| |
25+
LL| |#[coverage(off)]
26+
LL| |fn main() {
27+
LL| | used_generic(0u32);
28+
LL| | used_fn();
29+
LL| |}
30+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Function name: except_unused::unused_fn (unused)
2+
Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 01, 02, 02]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 0
6+
Number of file 0 mappings: 1
7+
- Code(Zero) at (prev + 21, 1) to (start + 2, 2)
8+
9+
Function name: except_unused::used_fn
10+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
11+
Number of files: 1
12+
- file 0 => global file 1
13+
Number of expressions: 0
14+
Number of file 0 mappings: 1
15+
- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)
16+
17+
Function name: except_unused::used_generic::<u32>
18+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 09, 01, 02, 02]
19+
Number of files: 1
20+
- file 0 => global file 1
21+
Number of expressions: 0
22+
Number of file 0 mappings: 1
23+
- Code(Counter(0)) at (prev + 9, 1) to (start + 2, 2)
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
LL| |#![feature(coverage_attribute)]
2+
LL| |#![allow(dead_code)]
3+
LL| |
4+
LL| |//@ edition: 2021
5+
LL| |//@ revisions: default functions generics
6+
LL| |//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
7+
LL| |//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
8+
LL| |
9+
LL| 1|fn used_generic<T>(_x: T) {
10+
LL| 1| println!("used_generic");
11+
LL| 1|}
12+
LL| |
13+
LL| |fn unused_generic<T>(_x: T) {
14+
LL| | println!("unused_generic");
15+
LL| |}
16+
LL| |
17+
LL| 1|fn used_fn() {
18+
LL| 1| println!("used_fn");
19+
LL| 1|}
20+
LL| |
21+
LL| 0|fn unused_fn() {
22+
LL| 0| println!("unused_fn");
23+
LL| 0|}
24+
LL| |
25+
LL| |#[coverage(off)]
26+
LL| |fn main() {
27+
LL| | used_generic(0u32);
28+
LL| | used_fn();
29+
LL| |}
30+

tests/coverage/except-unused.rs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#![feature(coverage_attribute)]
2+
#![allow(dead_code)]
3+
4+
//@ edition: 2021
5+
//@ revisions: default functions generics
6+
//@ [functions] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-functions
7+
//@ [generics] compile-flags: -Zunstable-options -Cinstrument-coverage=except-unused-generics
8+
9+
fn used_generic<T>(_x: T) {
10+
println!("used_generic");
11+
}
12+
13+
fn unused_generic<T>(_x: T) {
14+
println!("unused_generic");
15+
}
16+
17+
fn used_fn() {
18+
println!("used_fn");
19+
}
20+
21+
fn unused_fn() {
22+
println!("unused_fn");
23+
}
24+
25+
#[coverage(off)]
26+
fn main() {
27+
used_generic(0u32);
28+
used_fn();
29+
}

0 commit comments

Comments
 (0)