Skip to content

Commit 6798eca

Browse files
committed
Coverage test for allowing coverage in a #![no_core] crate
1 parent 972663d commit 6798eca

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

tests/coverage/no-core.cov-map

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Function name: no_core::main
2+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 01, 00, 0d]
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 + 12, 1) to (start + 0, 13)
8+
Highest counter ID seen: c0
9+

tests/coverage/no-core.coverage

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
LL| |#![feature(no_core)]
2+
LL| |#![no_core]
3+
LL| |//@ edition: 2021
4+
LL| |
5+
LL| |// Test that coverage instrumentation works for `#![no_core]` crates.
6+
LL| |
7+
LL| |// For this test, we pull in std anyway, to avoid having to set up our own
8+
LL| |// no-core or no-std environment. What's important is that the compiler allows
9+
LL| |// coverage for a crate with the `#![no_core]` annotation.
10+
LL| |extern crate std;
11+
LL| |
12+
LL| 1|fn main() {}
13+

tests/coverage/no-core.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(no_core)]
2+
#![no_core]
3+
//@ edition: 2021
4+
5+
// Test that coverage instrumentation works for `#![no_core]` crates.
6+
7+
// For this test, we pull in std anyway, to avoid having to set up our own
8+
// no-core or no-std environment. What's important is that the compiler allows
9+
// coverage for a crate with the `#![no_core]` annotation.
10+
extern crate std;
11+
12+
fn main() {}

0 commit comments

Comments
 (0)