summaryrefslogtreecommitdiffstats
path: root/tests/coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /tests/coverage
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/coverage')
-rw-r--r--tests/coverage/assert_not.cov-map16
-rw-r--r--tests/coverage/assert_not.coverage12
-rw-r--r--tests/coverage/assert_not.rs11
-rw-r--r--tests/coverage/async.cov-map174
-rw-r--r--tests/coverage/async.coverage43
-rw-r--r--tests/coverage/async.rs26
-rw-r--r--tests/coverage/async2.cov-map96
-rw-r--r--tests/coverage/async2.coverage80
-rw-r--r--tests/coverage/async2.rs24
-rw-r--r--tests/coverage/async_block.cov-map32
-rw-r--r--tests/coverage/async_block.coverage37
-rw-r--r--tests/coverage/async_block.rs35
-rw-r--r--tests/coverage/closure_macro_async.cov-map16
-rw-r--r--tests/coverage/closure_macro_async.coverage26
-rw-r--r--tests/coverage/closure_macro_async.rs26
-rw-r--r--tests/coverage/conditions.cov-map10
-rw-r--r--tests/coverage/continue.cov-map46
-rw-r--r--tests/coverage/coroutine.cov-map8
-rw-r--r--tests/coverage/if_not.cov-map39
-rw-r--r--tests/coverage/if_not.coverage38
-rw-r--r--tests/coverage/if_not.rs37
-rw-r--r--tests/coverage/inline.cov-map4
-rw-r--r--tests/coverage/inline.coverage2
-rw-r--r--tests/coverage/lazy_boolean.cov-map8
-rw-r--r--tests/coverage/lazy_boolean.coverage2
-rw-r--r--tests/coverage/loops_branches.cov-map90
-rw-r--r--tests/coverage/no_spans.cov-map8
-rw-r--r--tests/coverage/no_spans.coverage30
-rw-r--r--tests/coverage/no_spans.rs29
-rw-r--r--tests/coverage/no_spans_if_not.cov-map8
-rw-r--r--tests/coverage/no_spans_if_not.coverage30
-rw-r--r--tests/coverage/no_spans_if_not.rs29
-rw-r--r--tests/coverage/thin-lto.cov-map8
-rw-r--r--tests/coverage/thin-lto.coverage5
-rw-r--r--tests/coverage/thin-lto.rs4
-rw-r--r--tests/coverage/try_error_result.cov-map18
-rw-r--r--tests/coverage/unreachable.cov-map12
-rw-r--r--tests/coverage/unreachable.coverage4
38 files changed, 656 insertions, 467 deletions
diff --git a/tests/coverage/assert_not.cov-map b/tests/coverage/assert_not.cov-map
new file mode 100644
index 000000000..788bc5dbf
--- /dev/null
+++ b/tests/coverage/assert_not.cov-map
@@ -0,0 +1,16 @@
+Function name: assert_not::main
+Raw bytes (33): 0x[01, 01, 02, 05, 00, 0d, 00, 05, 01, 06, 01, 01, 12, 05, 02, 05, 00, 14, 02, 01, 05, 00, 14, 0d, 01, 05, 00, 16, 06, 01, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(1), rhs = Zero
+- expression 1 operands: lhs = Counter(3), rhs = Zero
+Number of file 0 mappings: 5
+- Code(Counter(0)) at (prev + 6, 1) to (start + 1, 18)
+- Code(Counter(1)) at (prev + 2, 5) to (start + 0, 20)
+- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 20)
+ = (c1 - Zero)
+- Code(Counter(3)) at (prev + 1, 5) to (start + 0, 22)
+- Code(Expression(1, Sub)) at (prev + 1, 1) to (start + 0, 2)
+ = (c3 - Zero)
+
diff --git a/tests/coverage/assert_not.coverage b/tests/coverage/assert_not.coverage
new file mode 100644
index 000000000..4cfdab974
--- /dev/null
+++ b/tests/coverage/assert_not.coverage
@@ -0,0 +1,12 @@
+ LL| |// edition: 2021
+ LL| |
+ LL| |// Regression test for <https://github.com/rust-lang/rust/issues/118904>.
+ LL| |// `assert!(true)` and `assert!(!false)` should have similar coverage spans.
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| assert!(true);
+ LL| 1| assert!(!false);
+ LL| 1| assert!(!!true);
+ LL| 1| assert!(!!!false);
+ LL| 1|}
+
diff --git a/tests/coverage/assert_not.rs b/tests/coverage/assert_not.rs
new file mode 100644
index 000000000..95204fcad
--- /dev/null
+++ b/tests/coverage/assert_not.rs
@@ -0,0 +1,11 @@
+// edition: 2021
+
+// Regression test for <https://github.com/rust-lang/rust/issues/118904>.
+// `assert!(true)` and `assert!(!false)` should have similar coverage spans.
+
+fn main() {
+ assert!(true);
+ assert!(!false);
+ assert!(!!true);
+ assert!(!!!false);
+}
diff --git a/tests/coverage/async.cov-map b/tests/coverage/async.cov-map
index 598791537..6bdcca40e 100644
--- a/tests/coverage/async.cov-map
+++ b/tests/coverage/async.cov-map
@@ -1,20 +1,20 @@
Function name: async::c
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 05, 01, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 5, 1) to (start + 0, 25)
+- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 25)
Function name: async::c::{closure#0}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 05, 19, 01, 0e, 05, 02, 09, 00, 0a, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 07, 19, 01, 0e, 05, 02, 09, 00, 0a, 02, 02, 09, 00, 0a, 07, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 5, 25) to (start + 1, 14)
+- Code(Counter(0)) at (prev + 7, 25) to (start + 1, 14)
- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 10)
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 10)
= (c0 - c1)
@@ -22,136 +22,84 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: async::d
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 01, 00, 14]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 01, 00, 14]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 13, 1) to (start + 0, 20)
+- Code(Counter(0)) at (prev + 15, 1) to (start + 0, 20)
Function name: async::d::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 14, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 14, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 13, 20) to (start + 0, 25)
+- Code(Counter(0)) at (prev + 15, 20) to (start + 0, 25)
Function name: async::e (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 00, 0f, 01, 00, 14]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 11, 01, 00, 14]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Zero) at (prev + 15, 1) to (start + 0, 20)
+- Code(Zero) at (prev + 17, 1) to (start + 0, 20)
Function name: async::e::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 00, 0f, 14, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 11, 14, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Zero) at (prev + 15, 20) to (start + 0, 25)
-
-Function name: async::executor::block_on::<core::pin::Pin<&mut async::i::{closure#0}>>
-Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 6e, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 3
-- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-Number of file 0 mappings: 6
-- Code(Counter(0)) at (prev + 110, 5) to (start + 10, 54)
-- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
- = ((c0 + c1) - c1)
-- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
- = (c0 + c1)
-- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
- = ((c0 + c1) - c1)
-- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
- = ((c0 + c1) - c1)
-
-Function name: async::executor::block_on::VTABLE::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 72, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 114, 17) to (start + 0, 51)
-
-Function name: async::executor::block_on::VTABLE::{closure#1}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 73, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 115, 17) to (start + 0, 51)
-
-Function name: async::executor::block_on::VTABLE::{closure#2}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 74, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 116, 17) to (start + 0, 51)
-
-Function name: async::executor::block_on::VTABLE::{closure#3}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 75, 11, 00, 13]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 117, 17) to (start + 0, 19)
+- Code(Zero) at (prev + 17, 20) to (start + 0, 25)
Function name: async::f
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 00, 14]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 14]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 17, 1) to (start + 0, 20)
+- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 20)
Function name: async::f::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 14, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 14, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 17, 20) to (start + 0, 25)
+- Code(Counter(0)) at (prev + 19, 20) to (start + 0, 25)
Function name: async::foo (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 01, 00, 1e]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 01, 00, 1e]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Zero) at (prev + 19, 1) to (start + 0, 30)
+- Code(Zero) at (prev + 21, 1) to (start + 0, 30)
Function name: async::foo::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 00, 13, 1e, 00, 2d]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 15, 1e, 00, 2d]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Zero) at (prev + 19, 30) to (start + 0, 45)
+- Code(Zero) at (prev + 21, 30) to (start + 0, 45)
Function name: async::g
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 17]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 00, 17]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 23)
+- Code(Counter(0)) at (prev + 23, 1) to (start + 0, 23)
Function name: async::g::{closure#0} (unused)
-Raw bytes (69): 0x[01, 01, 00, 0d, 00, 15, 17, 01, 0c, 00, 02, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (69): 0x[01, 01, 00, 0d, 00, 17, 17, 01, 0c, 00, 02, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 09, 00, 0a, 00, 00, 0e, 00, 11, 00, 00, 12, 00, 17, 00, 00, 1b, 00, 1c, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 13
-- Code(Zero) at (prev + 21, 23) to (start + 1, 12)
+- Code(Zero) at (prev + 23, 23) to (start + 1, 12)
- Code(Zero) at (prev + 2, 9) to (start + 0, 10)
- Code(Zero) at (prev + 0, 14) to (start + 0, 17)
- Code(Zero) at (prev + 0, 18) to (start + 0, 23)
@@ -166,20 +114,20 @@ Number of file 0 mappings: 13
- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
Function name: async::h
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 00, 16]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1f, 01, 00, 16]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 29, 1) to (start + 0, 22)
+- Code(Counter(0)) at (prev + 31, 1) to (start + 0, 22)
Function name: async::h::{closure#0} (unused)
-Raw bytes (44): 0x[01, 01, 00, 08, 00, 1d, 16, 03, 0c, 00, 04, 09, 00, 0a, 00, 00, 0e, 00, 13, 00, 00, 14, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (44): 0x[01, 01, 00, 08, 00, 1f, 16, 03, 0c, 00, 04, 09, 00, 0a, 00, 00, 0e, 00, 13, 00, 00, 14, 00, 19, 00, 00, 1a, 00, 1b, 00, 00, 20, 00, 22, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 8
-- Code(Zero) at (prev + 29, 22) to (start + 3, 12)
+- Code(Zero) at (prev + 31, 22) to (start + 3, 12)
- Code(Zero) at (prev + 4, 9) to (start + 0, 10)
- Code(Zero) at (prev + 0, 14) to (start + 0, 19)
- Code(Zero) at (prev + 0, 20) to (start + 0, 25)
@@ -189,22 +137,22 @@ Number of file 0 mappings: 8
- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
Function name: async::i
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 26, 01, 00, 13]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 28, 01, 00, 13]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 38, 1) to (start + 0, 19)
+- Code(Counter(0)) at (prev + 40, 1) to (start + 0, 19)
Function name: async::i::{closure#0}
-Raw bytes (78): 0x[01, 01, 02, 19, 07, 1d, 21, 0e, 01, 26, 13, 04, 0c, 0d, 05, 09, 00, 0a, 01, 00, 0e, 00, 12, 05, 00, 13, 00, 18, 09, 00, 1c, 00, 21, 0d, 00, 27, 00, 2a, 15, 00, 2b, 00, 30, 1d, 01, 09, 00, 0a, 11, 00, 0e, 00, 11, 25, 00, 12, 00, 17, 29, 00, 1b, 00, 20, 1d, 00, 24, 00, 26, 21, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
+Raw bytes (78): 0x[01, 01, 02, 07, 21, 19, 1d, 0e, 01, 28, 13, 04, 0c, 0d, 05, 09, 00, 0a, 01, 00, 0e, 00, 12, 05, 00, 13, 00, 18, 09, 00, 1c, 00, 21, 0d, 00, 27, 00, 2a, 15, 00, 2b, 00, 30, 1d, 01, 09, 00, 0a, 11, 00, 0e, 00, 11, 25, 00, 12, 00, 17, 29, 00, 1b, 00, 20, 1d, 00, 24, 00, 26, 21, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
-- expression 0 operands: lhs = Counter(6), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(8)
+- expression 1 operands: lhs = Counter(6), rhs = Counter(7)
Number of file 0 mappings: 14
-- Code(Counter(0)) at (prev + 38, 19) to (start + 4, 12)
+- Code(Counter(0)) at (prev + 40, 19) to (start + 4, 12)
- Code(Counter(3)) at (prev + 5, 9) to (start + 0, 10)
- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 18)
- Code(Counter(1)) at (prev + 0, 19) to (start + 0, 24)
@@ -218,17 +166,17 @@ Number of file 0 mappings: 14
- Code(Counter(7)) at (prev + 0, 36) to (start + 0, 38)
- Code(Counter(8)) at (prev + 1, 14) to (start + 0, 16)
- Code(Expression(0, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (c6 + (c7 + c8))
+ = ((c6 + c7) + c8)
Function name: async::j
-Raw bytes (53): 0x[01, 01, 02, 05, 07, 09, 0d, 09, 01, 31, 01, 13, 0c, 05, 14, 09, 00, 0a, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
+Raw bytes (53): 0x[01, 01, 02, 07, 0d, 05, 09, 09, 01, 33, 01, 13, 0c, 05, 14, 09, 00, 0a, 01, 00, 0e, 00, 1b, 05, 00, 1f, 00, 27, 09, 01, 09, 00, 0a, 11, 00, 0e, 00, 1a, 09, 00, 1e, 00, 20, 0d, 01, 0e, 00, 10, 03, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
-- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
Number of file 0 mappings: 9
-- Code(Counter(0)) at (prev + 49, 1) to (start + 19, 12)
+- Code(Counter(0)) at (prev + 51, 1) to (start + 19, 12)
- Code(Counter(1)) at (prev + 20, 9) to (start + 0, 10)
- Code(Counter(0)) at (prev + 0, 14) to (start + 0, 27)
- Code(Counter(1)) at (prev + 0, 31) to (start + 0, 39)
@@ -237,17 +185,17 @@ Number of file 0 mappings: 9
- Code(Counter(2)) at (prev + 0, 30) to (start + 0, 32)
- Code(Counter(3)) at (prev + 1, 14) to (start + 0, 16)
- Code(Expression(0, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (c1 + (c2 + c3))
+ = ((c1 + c2) + c3)
Function name: async::j::c
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 33, 05, 01, 12, 05, 02, 0d, 00, 0e, 02, 0a, 0d, 00, 0e, 07, 02, 05, 00, 06]
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 35, 05, 01, 12, 05, 02, 0d, 00, 0e, 02, 0a, 0d, 00, 0e, 07, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 51, 5) to (start + 1, 18)
+- Code(Counter(0)) at (prev + 53, 5) to (start + 1, 18)
- Code(Counter(1)) at (prev + 2, 13) to (start + 0, 14)
- Code(Expression(0, Sub)) at (prev + 10, 13) to (start + 0, 14)
= (c0 - c1)
@@ -255,72 +203,72 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: async::j::d
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 42, 05, 00, 17]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 44, 05, 00, 17]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 66, 5) to (start + 0, 23)
+- Code(Counter(0)) at (prev + 68, 5) to (start + 0, 23)
Function name: async::j::f
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 43, 05, 00, 17]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 45, 05, 00, 17]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 67, 5) to (start + 0, 23)
+- Code(Counter(0)) at (prev + 69, 5) to (start + 0, 23)
Function name: async::k (unused)
-Raw bytes (29): 0x[01, 01, 00, 05, 00, 4b, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
+Raw bytes (29): 0x[01, 01, 00, 05, 00, 4d, 01, 01, 0c, 00, 02, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 01, 0e, 00, 10, 00, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 5
-- Code(Zero) at (prev + 75, 1) to (start + 1, 12)
+- Code(Zero) at (prev + 77, 1) to (start + 1, 12)
- Code(Zero) at (prev + 2, 14) to (start + 0, 16)
- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
- Code(Zero) at (prev + 1, 14) to (start + 0, 16)
- Code(Zero) at (prev + 2, 1) to (start + 0, 2)
Function name: async::l
-Raw bytes (37): 0x[01, 01, 04, 01, 07, 09, 05, 09, 0f, 05, 02, 05, 01, 53, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02]
+Raw bytes (37): 0x[01, 01, 04, 01, 07, 05, 09, 0f, 02, 09, 05, 05, 01, 55, 01, 01, 0c, 02, 02, 0e, 00, 10, 05, 01, 0e, 00, 10, 09, 01, 0e, 00, 10, 0b, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(2), rhs = Expression(3, Add)
-- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 2 operands: lhs = Expression(3, Add), rhs = Expression(0, Sub)
+- expression 3 operands: lhs = Counter(2), rhs = Counter(1)
Number of file 0 mappings: 5
-- Code(Counter(0)) at (prev + 83, 1) to (start + 1, 12)
+- Code(Counter(0)) at (prev + 85, 1) to (start + 1, 12)
- Code(Expression(0, Sub)) at (prev + 2, 14) to (start + 0, 16)
- = (c0 - (c2 + c1))
+ = (c0 - (c1 + c2))
- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 16)
- Code(Counter(2)) at (prev + 1, 14) to (start + 0, 16)
- Code(Expression(2, Add)) at (prev + 2, 1) to (start + 0, 2)
- = (c2 + (c1 + (c0 - (c2 + c1))))
+ = ((c2 + c1) + (c0 - (c1 + c2)))
Function name: async::m
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 5b, 01, 00, 19]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 5d, 01, 00, 19]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 91, 1) to (start + 0, 25)
+- Code(Counter(0)) at (prev + 93, 1) to (start + 0, 25)
Function name: async::m::{closure#0} (unused)
-Raw bytes (9): 0x[01, 01, 00, 01, 00, 5b, 19, 00, 22]
+Raw bytes (9): 0x[01, 01, 00, 01, 00, 5d, 19, 00, 22]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Zero) at (prev + 91, 25) to (start + 0, 34)
+- Code(Zero) at (prev + 93, 25) to (start + 0, 34)
Function name: async::main
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 5d, 01, 08, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 5f, 01, 08, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 93, 1) to (start + 8, 2)
+- Code(Counter(0)) at (prev + 95, 1) to (start + 8, 2)
diff --git a/tests/coverage/async.coverage b/tests/coverage/async.coverage
index 07bc16c2d..015e03d51 100644
--- a/tests/coverage/async.coverage
+++ b/tests/coverage/async.coverage
@@ -1,6 +1,8 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |#![feature(noop_waker)]
LL| |#![allow(unused_assignments, dead_code)]
- LL| |
- LL| |// compile-flags: --edition=2018 -C opt-level=1
+ LL| |// edition: 2018
+ LL| |// compile-flags: -Copt-level=1
LL| |
LL| 1|async fn c(x: u8) -> u8 {
LL| 1| if x == 8 {
@@ -108,32 +110,21 @@
LL| 1|}
LL| |
LL| |mod executor {
- LL| | use core::{
- LL| | future::Future,
- LL| | pin::Pin,
- LL| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- LL| | };
- LL| |
- LL| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output {
- LL| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) };
- LL| 1| use std::hint::unreachable_unchecked;
- LL| 1| static VTABLE: RawWakerVTable = RawWakerVTable::new(
- LL| 1| |_| unsafe { unreachable_unchecked() }, // clone
- ^0
- LL| 1| |_| unsafe { unreachable_unchecked() }, // wake
- ^0
- LL| 1| |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- ^0
- LL| 1| |_| (),
- LL| 1| );
- LL| 1| let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- LL| 1| let mut context = Context::from_waker(&waker);
+ LL| | use core::future::Future;
+ LL| | use core::pin::pin;
+ LL| | use core::task::{Context, Poll, Waker};
+ LL| |
+ LL| | #[coverage(off)]
+ LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ LL| | let mut future = pin!(future);
+ LL| | let waker = Waker::noop();
+ LL| | let mut context = Context::from_waker(&waker);
LL| |
LL| | loop {
- LL| 1| if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- LL| 1| break val;
- LL| 0| }
+ LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ LL| | break val;
+ LL| | }
LL| | }
- LL| 1| }
+ LL| | }
LL| |}
diff --git a/tests/coverage/async.rs b/tests/coverage/async.rs
index efd9e62d6..abc9e5f7f 100644
--- a/tests/coverage/async.rs
+++ b/tests/coverage/async.rs
@@ -1,6 +1,8 @@
+#![feature(coverage_attribute)]
+#![feature(noop_waker)]
#![allow(unused_assignments, dead_code)]
-
-// compile-flags: --edition=2018 -C opt-level=1
+// edition: 2018
+// compile-flags: -Copt-level=1
async fn c(x: u8) -> u8 {
if x == 8 {
@@ -101,22 +103,14 @@ fn main() {
}
mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
+ use core::future::Future;
+ use core::pin::pin;
+ use core::task::{Context, Poll, Waker};
+ #[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- |_| unsafe { unreachable_unchecked() }, // clone
- |_| unsafe { unreachable_unchecked() }, // wake
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut future = pin!(future);
+ let waker = Waker::noop();
let mut context = Context::from_waker(&waker);
loop {
diff --git a/tests/coverage/async2.cov-map b/tests/coverage/async2.cov-map
index cc7aed9ae..b120e28c4 100644
--- a/tests/coverage/async2.cov-map
+++ b/tests/coverage/async2.cov-map
@@ -1,20 +1,20 @@
Function name: async2::async_func
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 01, 00, 17]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0d, 01, 00, 17]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 11, 1) to (start + 0, 23)
+- Code(Counter(0)) at (prev + 13, 1) to (start + 0, 23)
Function name: async2::async_func::{closure#0}
-Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0b, 17, 03, 09, 05, 03, 0a, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 0d, 17, 03, 09, 05, 03, 0a, 02, 06, 02, 02, 06, 00, 07, 07, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 11, 23) to (start + 3, 9)
+- Code(Counter(0)) at (prev + 13, 23) to (start + 3, 9)
- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
= (c0 - c1)
@@ -22,109 +22,37 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: async2::async_func_just_println
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 01, 00, 24]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 00, 24]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 19, 1) to (start + 0, 36)
+- Code(Counter(0)) at (prev + 21, 1) to (start + 0, 36)
Function name: async2::async_func_just_println::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 13, 24, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 24, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 19, 36) to (start + 2, 2)
-
-Function name: async2::executor::block_on::<async2::async_func::{closure#0}>
-Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 3
-- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-Number of file 0 mappings: 6
-- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
-- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
- = ((c0 + c1) - c1)
-- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
- = (c0 + c1)
-- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
- = ((c0 + c1) - c1)
-- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
- = ((c0 + c1) - c1)
-
-Function name: async2::executor::block_on::<async2::async_func_just_println::{closure#0}>
-Raw bytes (40): 0x[01, 01, 03, 0b, 05, 01, 05, 01, 05, 06, 01, 27, 05, 0a, 36, 02, 0d, 20, 00, 23, 0b, 00, 27, 00, 49, 02, 01, 17, 00, 1a, 05, 01, 0e, 00, 0f, 02, 02, 05, 00, 06]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 3
-- expression 0 operands: lhs = Expression(2, Add), rhs = Counter(1)
-- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
-- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
-Number of file 0 mappings: 6
-- Code(Counter(0)) at (prev + 39, 5) to (start + 10, 54)
-- Code(Expression(0, Sub)) at (prev + 13, 32) to (start + 0, 35)
- = ((c0 + c1) - c1)
-- Code(Expression(2, Add)) at (prev + 0, 39) to (start + 0, 73)
- = (c0 + c1)
-- Code(Expression(0, Sub)) at (prev + 1, 23) to (start + 0, 26)
- = ((c0 + c1) - c1)
-- Code(Counter(1)) at (prev + 1, 14) to (start + 0, 15)
-- Code(Expression(0, Sub)) at (prev + 2, 5) to (start + 0, 6)
- = ((c0 + c1) - c1)
-
-Function name: async2::executor::block_on::VTABLE::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 2b, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 43, 17) to (start + 0, 51)
-
-Function name: async2::executor::block_on::VTABLE::{closure#1}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 2c, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 44, 17) to (start + 0, 51)
-
-Function name: async2::executor::block_on::VTABLE::{closure#2}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 2d, 11, 00, 33]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 45, 17) to (start + 0, 51)
-
-Function name: async2::executor::block_on::VTABLE::{closure#3}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 2e, 11, 00, 13]
-Number of files: 1
-- file 0 => global file 1
-Number of expressions: 0
-Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 46, 17) to (start + 0, 19)
+- Code(Counter(0)) at (prev + 21, 36) to (start + 2, 2)
Function name: async2::main
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 17, 01, 07, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 19, 01, 07, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 23, 1) to (start + 7, 2)
+- Code(Counter(0)) at (prev + 25, 1) to (start + 7, 2)
Function name: async2::non_async_func
-Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 03, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 03, 01, 01, 00, 02]
+Raw bytes (26): 0x[01, 01, 01, 05, 00, 04, 01, 05, 01, 03, 09, 05, 03, 0a, 02, 06, 00, 02, 06, 00, 07, 03, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 1
- expression 0 operands: lhs = Counter(1), rhs = Zero
Number of file 0 mappings: 4
-- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 9)
+- Code(Counter(0)) at (prev + 5, 1) to (start + 3, 9)
- Code(Counter(1)) at (prev + 3, 10) to (start + 2, 6)
- Code(Zero) at (prev + 2, 6) to (start + 0, 7)
- Code(Expression(0, Add)) at (prev + 1, 1) to (start + 0, 2)
diff --git a/tests/coverage/async2.coverage b/tests/coverage/async2.coverage
index fcb0a3aed..acd83de94 100644
--- a/tests/coverage/async2.coverage
+++ b/tests/coverage/async2.coverage
@@ -1,4 +1,6 @@
- LL| |// compile-flags: --edition=2018
+ LL| |#![feature(coverage_attribute)]
+ LL| |#![feature(noop_waker)]
+ LL| |// edition: 2018
LL| |
LL| 1|fn non_async_func() {
LL| 1| println!("non_async_func was covered");
@@ -32,73 +34,21 @@
LL| 1|}
LL| |
LL| |mod executor {
- LL| | use core::{
- LL| | future::Future,
- LL| | pin::Pin,
- LL| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- LL| | };
+ LL| | use core::future::Future;
+ LL| | use core::pin::pin;
+ LL| | use core::task::{Context, Poll, Waker};
LL| |
- LL| 2| pub fn block_on<F: Future>(mut future: F) -> F::Output {
- LL| 2| let mut future = unsafe { Pin::new_unchecked(&mut future) };
- LL| 2| use std::hint::unreachable_unchecked;
- LL| 2| static VTABLE: RawWakerVTable = RawWakerVTable::new(
- LL| 2| |_| unsafe { unreachable_unchecked() }, // clone
- ^0
- LL| 2| |_| unsafe { unreachable_unchecked() }, // wake
- ^0
- LL| 2| |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- ^0
- LL| 2| |_| (),
- LL| 2| );
- LL| 2| let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- LL| 2| let mut context = Context::from_waker(&waker);
+ LL| | #[coverage(off)]
+ LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ LL| | let mut future = pin!(future);
+ LL| | let waker = Waker::noop();
+ LL| | let mut context = Context::from_waker(&waker);
LL| |
LL| | loop {
- LL| 2| if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- LL| 2| break val;
- LL| 0| }
+ LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ LL| | break val;
+ LL| | }
LL| | }
- LL| 2| }
- ------------------
- | async2::executor::block_on::<async2::async_func::{closure#0}>:
- | LL| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output {
- | LL| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) };
- | LL| 1| use std::hint::unreachable_unchecked;
- | LL| 1| static VTABLE: RawWakerVTable = RawWakerVTable::new(
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // clone
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // wake
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- | LL| 1| |_| (),
- | LL| 1| );
- | LL| 1| let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- | LL| 1| let mut context = Context::from_waker(&waker);
- | LL| |
- | LL| | loop {
- | LL| 1| if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- | LL| 1| break val;
- | LL| 0| }
- | LL| | }
- | LL| 1| }
- ------------------
- | async2::executor::block_on::<async2::async_func_just_println::{closure#0}>:
- | LL| 1| pub fn block_on<F: Future>(mut future: F) -> F::Output {
- | LL| 1| let mut future = unsafe { Pin::new_unchecked(&mut future) };
- | LL| 1| use std::hint::unreachable_unchecked;
- | LL| 1| static VTABLE: RawWakerVTable = RawWakerVTable::new(
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // clone
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // wake
- | LL| 1| |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- | LL| 1| |_| (),
- | LL| 1| );
- | LL| 1| let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
- | LL| 1| let mut context = Context::from_waker(&waker);
- | LL| |
- | LL| | loop {
- | LL| 1| if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
- | LL| 1| break val;
- | LL| 0| }
- | LL| | }
- | LL| 1| }
- ------------------
+ LL| | }
LL| |}
diff --git a/tests/coverage/async2.rs b/tests/coverage/async2.rs
index 2884ff297..393573f7d 100644
--- a/tests/coverage/async2.rs
+++ b/tests/coverage/async2.rs
@@ -1,4 +1,6 @@
-// compile-flags: --edition=2018
+#![feature(coverage_attribute)]
+#![feature(noop_waker)]
+// edition: 2018
fn non_async_func() {
println!("non_async_func was covered");
@@ -30,22 +32,14 @@ fn main() {
}
mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
+ use core::future::Future;
+ use core::pin::pin;
+ use core::task::{Context, Poll, Waker};
+ #[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- |_| unsafe { unreachable_unchecked() }, // clone
- |_| unsafe { unreachable_unchecked() }, // wake
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut future = pin!(future);
+ let waker = Waker::noop();
let mut context = Context::from_waker(&waker);
loop {
diff --git a/tests/coverage/async_block.cov-map b/tests/coverage/async_block.cov-map
new file mode 100644
index 000000000..104133f6e
--- /dev/null
+++ b/tests/coverage/async_block.cov-map
@@ -0,0 +1,32 @@
+Function name: async_block::main
+Raw bytes (38): 0x[01, 01, 02, 01, 05, 03, 05, 06, 01, 05, 01, 00, 0b, 05, 01, 09, 00, 0a, 03, 00, 0e, 00, 13, 05, 00, 14, 01, 16, 05, 07, 0a, 02, 06, 06, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(1)
+Number of file 0 mappings: 6
+- Code(Counter(0)) at (prev + 5, 1) to (start + 0, 11)
+- Code(Counter(1)) at (prev + 1, 9) to (start + 0, 10)
+- Code(Expression(0, Add)) at (prev + 0, 14) to (start + 0, 19)
+ = (c0 + c1)
+- Code(Counter(1)) at (prev + 0, 20) to (start + 1, 22)
+- Code(Counter(1)) at (prev + 7, 10) to (start + 2, 6)
+- Code(Expression(1, Sub)) at (prev + 3, 1) to (start + 0, 2)
+ = ((c0 + c1) - c1)
+
+Function name: async_block::main::{closure#0}
+Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 07, 1c, 01, 17, 05, 01, 18, 02, 0e, 02, 02, 14, 02, 0e, 07, 03, 09, 00, 0a]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 2
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 4
+- Code(Counter(0)) at (prev + 7, 28) to (start + 1, 23)
+- Code(Counter(1)) at (prev + 1, 24) to (start + 2, 14)
+- Code(Expression(0, Sub)) at (prev + 2, 20) to (start + 2, 14)
+ = (c0 - c1)
+- Code(Expression(1, Add)) at (prev + 3, 9) to (start + 0, 10)
+ = (c1 + (c0 - c1))
+
diff --git a/tests/coverage/async_block.coverage b/tests/coverage/async_block.coverage
new file mode 100644
index 000000000..297397ca2
--- /dev/null
+++ b/tests/coverage/async_block.coverage
@@ -0,0 +1,37 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |#![feature(noop_waker)]
+ LL| |// edition: 2021
+ LL| |
+ LL| 1|fn main() {
+ LL| 17| for i in 0..16 {
+ ^16
+ LL| 16| let future = async {
+ LL| 16| if i >= 12 {
+ LL| 4| println!("big");
+ LL| 12| } else {
+ LL| 12| println!("small");
+ LL| 12| }
+ LL| 16| };
+ LL| 16| executor::block_on(future);
+ LL| 16| }
+ LL| 1|}
+ LL| |
+ LL| |mod executor {
+ LL| | use core::future::Future;
+ LL| | use core::pin::pin;
+ LL| | use core::task::{Context, Poll, Waker};
+ LL| |
+ LL| | #[coverage(off)]
+ LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ LL| | let mut future = pin!(future);
+ LL| | let waker = Waker::noop();
+ LL| | let mut context = Context::from_waker(&waker);
+ LL| |
+ LL| | loop {
+ LL| | if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ LL| | break val;
+ LL| | }
+ LL| | }
+ LL| | }
+ LL| |}
+
diff --git a/tests/coverage/async_block.rs b/tests/coverage/async_block.rs
new file mode 100644
index 000000000..9d8647bf1
--- /dev/null
+++ b/tests/coverage/async_block.rs
@@ -0,0 +1,35 @@
+#![feature(coverage_attribute)]
+#![feature(noop_waker)]
+// edition: 2021
+
+fn main() {
+ for i in 0..16 {
+ let future = async {
+ if i >= 12 {
+ println!("big");
+ } else {
+ println!("small");
+ }
+ };
+ executor::block_on(future);
+ }
+}
+
+mod executor {
+ use core::future::Future;
+ use core::pin::pin;
+ use core::task::{Context, Poll, Waker};
+
+ #[coverage(off)]
+ pub fn block_on<F: Future>(mut future: F) -> F::Output {
+ let mut future = pin!(future);
+ let waker = Waker::noop();
+ let mut context = Context::from_waker(&waker);
+
+ loop {
+ if let Poll::Ready(val) = future.as_mut().poll(&mut context) {
+ break val;
+ }
+ }
+ }
+}
diff --git a/tests/coverage/closure_macro_async.cov-map b/tests/coverage/closure_macro_async.cov-map
index 7f8666948..14b1525ca 100644
--- a/tests/coverage/closure_macro_async.cov-map
+++ b/tests/coverage/closure_macro_async.cov-map
@@ -1,28 +1,28 @@
Function name: closure_macro_async::load_configuration_files
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 1d, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 01, 02, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 29, 1) to (start + 2, 2)
+- Code(Counter(0)) at (prev + 30, 1) to (start + 2, 2)
Function name: closure_macro_async::test
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 21, 01, 00, 2b]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 22, 01, 00, 2b]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 33, 1) to (start + 0, 43)
+- Code(Counter(0)) at (prev + 34, 1) to (start + 0, 43)
Function name: closure_macro_async::test::{closure#0}
-Raw bytes (43): 0x[01, 01, 02, 01, 05, 05, 02, 07, 01, 21, 2b, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 02, 00, 12, 00, 13, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 07, 03, 01, 00, 02]
+Raw bytes (43): 0x[01, 01, 02, 01, 05, 05, 02, 07, 01, 22, 2b, 01, 21, 02, 02, 09, 00, 0f, 05, 00, 12, 00, 13, 02, 00, 12, 00, 13, 05, 00, 54, 00, 55, 02, 02, 09, 02, 0b, 07, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 7
-- Code(Counter(0)) at (prev + 33, 43) to (start + 1, 33)
+- Code(Counter(0)) at (prev + 34, 43) to (start + 1, 33)
- Code(Expression(0, Sub)) at (prev + 2, 9) to (start + 0, 15)
= (c0 - c1)
- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
@@ -35,10 +35,10 @@ Number of file 0 mappings: 7
= (c1 + (c0 - c1))
Function name: closure_macro_async::test::{closure#0}::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 23, 12, 00, 54]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 24, 12, 00, 54]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 35, 18) to (start + 0, 84)
+- Code(Counter(0)) at (prev + 36, 18) to (start + 0, 84)
diff --git a/tests/coverage/closure_macro_async.coverage b/tests/coverage/closure_macro_async.coverage
index 74247f1bc..2c9bd4ac9 100644
--- a/tests/coverage/closure_macro_async.coverage
+++ b/tests/coverage/closure_macro_async.coverage
@@ -1,5 +1,6 @@
- LL| |// compile-flags: --edition=2018
LL| |#![feature(coverage_attribute)]
+ LL| |#![feature(noop_waker)]
+ LL| |// edition: 2018
LL| |
LL| |macro_rules! bail {
LL| | ($msg:literal $(,)?) => {
@@ -46,27 +47,14 @@
LL| |}
LL| |
LL| |mod executor {
- LL| | use core::{
- LL| | future::Future,
- LL| | pin::Pin,
- LL| | task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- LL| | };
+ LL| | use core::future::Future;
+ LL| | use core::pin::pin;
+ LL| | use core::task::{Context, Poll, Waker};
LL| |
LL| | #[coverage(off)]
LL| | pub fn block_on<F: Future>(mut future: F) -> F::Output {
- LL| | let mut future = unsafe { Pin::new_unchecked(&mut future) };
- LL| | use std::hint::unreachable_unchecked;
- LL| | static VTABLE: RawWakerVTable = RawWakerVTable::new(
- LL| | #[coverage(off)]
- LL| | |_| unsafe { unreachable_unchecked() }, // clone
- LL| | #[coverage(off)]
- LL| | |_| unsafe { unreachable_unchecked() }, // wake
- LL| | #[coverage(off)]
- LL| | |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- LL| | #[coverage(off)]
- LL| | |_| (),
- LL| | );
- LL| | let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ LL| | let mut future = pin!(future);
+ LL| | let waker = Waker::noop();
LL| | let mut context = Context::from_waker(&waker);
LL| |
LL| | loop {
diff --git a/tests/coverage/closure_macro_async.rs b/tests/coverage/closure_macro_async.rs
index b4275599e..a7f0cabb4 100644
--- a/tests/coverage/closure_macro_async.rs
+++ b/tests/coverage/closure_macro_async.rs
@@ -1,5 +1,6 @@
-// compile-flags: --edition=2018
#![feature(coverage_attribute)]
+#![feature(noop_waker)]
+// edition: 2018
macro_rules! bail {
($msg:literal $(,)?) => {
@@ -45,27 +46,14 @@ fn main() {
}
mod executor {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
- };
+ use core::future::Future;
+ use core::pin::pin;
+ use core::task::{Context, Poll, Waker};
#[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
- let mut future = unsafe { Pin::new_unchecked(&mut future) };
- use std::hint::unreachable_unchecked;
- static VTABLE: RawWakerVTable = RawWakerVTable::new(
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // clone
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // wake
- #[coverage(off)]
- |_| unsafe { unreachable_unchecked() }, // wake_by_ref
- #[coverage(off)]
- |_| (),
- );
- let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
+ let mut future = pin!(future);
+ let waker = Waker::noop();
let mut context = Context::from_waker(&waker);
loop {
diff --git a/tests/coverage/conditions.cov-map b/tests/coverage/conditions.cov-map
index 7600d2d96..cfee55ed3 100644
--- a/tests/coverage/conditions.cov-map
+++ b/tests/coverage/conditions.cov-map
@@ -1,5 +1,5 @@
Function name: conditions::main
-Raw bytes (784): 0x[01, 01, 8e, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, b7, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, b2, 04, 0d, b7, 04, 09, 05, 00, 45, 00, 83, 01, 49, 45, 00, 7e, 31, 83, 01, 49, 45, 00, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, 76, 51, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, a7, 01, 55, 4d, 51, a3, 01, 59, a7, 01, 55, 4d, 51, 49, 9f, 01, a3, 01, 59, a7, 01, 55, 4d, 51, 61, 00, e3, 01, 65, 61, 00, de, 01, 2d, e3, 01, 65, 61, 00, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, d6, 01, 6d, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, 8b, 02, 71, 69, 6d, 87, 02, 75, 8b, 02, 71, 69, 6d, ff, 01, 00, 65, 83, 02, 87, 02, 75, 8b, 02, 71, 69, 6d, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 79, 00, d7, 02, 7d, 79, 00, d2, 02, 29, d7, 02, 7d, 79, 00, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, ca, 02, 85, 01, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, f3, 03, 89, 01, 81, 01, 85, 01, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, da, 03, 19, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 9b, 04, 1d, 15, 19, 97, 04, 21, 9b, 04, 1d, 15, 19, 8f, 04, 9f, 04, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, a3, 04, ae, 04, a7, 04, ab, 04, 25, 29, 2d, 31, b2, 04, 0d, b7, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, b7, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, b2, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, ae, 04, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 83, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 7e, 02, 0f, 00, 1c, 7a, 01, 0c, 00, 19, 76, 00, 1d, 00, 2a, 72, 00, 2e, 00, 3c, a3, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, 9f, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9b, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e3, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, de, 01, 03, 11, 00, 1e, da, 01, 01, 10, 00, 1d, d6, 01, 00, 21, 00, 2e, d2, 01, 00, 32, 00, 40, 87, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 83, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, fb, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, e7, 03, 02, 09, 00, 0a, d7, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d2, 02, 02, 0f, 00, 1c, ce, 02, 01, 0c, 00, 19, ca, 02, 00, 1d, 00, 2a, c6, 02, 00, 2e, 00, 3c, ef, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, eb, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 8f, 04, 05, 09, 00, 0a, e7, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, e2, 03, 02, 0f, 00, 1c, de, 03, 01, 0c, 00, 19, da, 03, 00, 1d, 00, 2a, d6, 03, 00, 2e, 00, 3c, 97, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 93, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 8b, 04, 02, 01, 00, 02]
+Raw bytes (784): 0x[01, 01, 8e, 01, 09, 33, 37, 41, 3b, 3d, 35, 39, 05, 00, b7, 04, 09, 05, 00, 0d, 35, 26, 39, 0d, 35, 3b, 3d, 35, 39, 37, 41, 3b, 3d, 35, 39, b2, 04, 0d, b7, 04, 09, 05, 00, 45, 00, 83, 01, 49, 45, 00, 7e, 31, 83, 01, 49, 45, 00, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, 76, 51, 7a, 4d, 7e, 31, 83, 01, 49, 45, 00, a7, 01, 55, 4d, 51, a3, 01, 59, a7, 01, 55, 4d, 51, 49, 9f, 01, a3, 01, 59, a7, 01, 55, 4d, 51, 61, 00, e3, 01, 65, 61, 00, de, 01, 2d, e3, 01, 65, 61, 00, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, d6, 01, 6d, da, 01, 69, de, 01, 2d, e3, 01, 65, 61, 00, 8b, 02, 71, 69, 6d, 87, 02, 75, 8b, 02, 71, 69, 6d, ff, 01, 00, 65, 83, 02, 87, 02, 75, 8b, 02, 71, 69, 6d, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 79, 00, d7, 02, 7d, 79, 00, d2, 02, 29, d7, 02, 7d, 79, 00, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, ca, 02, 85, 01, ce, 02, 81, 01, d2, 02, 29, d7, 02, 7d, 79, 00, f3, 03, 89, 01, 81, 01, 85, 01, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, da, 03, 19, de, 03, 15, e2, 03, 25, e7, 03, 11, 7d, eb, 03, ef, 03, 8d, 01, f3, 03, 89, 01, 81, 01, 85, 01, 9b, 04, 1d, 15, 19, 97, 04, 21, 9b, 04, 1d, 15, 19, 8f, 04, 9f, 04, 11, 93, 04, 97, 04, 21, 9b, 04, 1d, 15, 19, a3, 04, ae, 04, a7, 04, 31, ab, 04, 2d, 25, 29, b2, 04, 0d, b7, 04, 09, 05, 00, 44, 01, 03, 01, 02, 0c, 05, 02, 0d, 02, 06, 00, 02, 06, 00, 07, 03, 03, 09, 00, 0a, b7, 04, 00, 10, 00, 1d, 09, 01, 09, 01, 0a, b2, 04, 02, 0f, 00, 1c, 0d, 01, 0c, 00, 19, 26, 00, 1d, 00, 2a, 22, 00, 2e, 00, 3c, 37, 00, 3d, 02, 0a, 41, 02, 0a, 00, 0b, 33, 01, 09, 01, 12, ae, 04, 03, 09, 00, 0f, 03, 03, 09, 01, 0c, 45, 01, 0d, 02, 06, 00, 02, 06, 00, 07, 83, 01, 02, 08, 00, 15, 49, 00, 16, 02, 06, 7e, 02, 0f, 00, 1c, 7a, 01, 0c, 00, 19, 76, 00, 1d, 00, 2a, 72, 00, 2e, 00, 3c, a3, 01, 00, 3d, 02, 0a, 59, 02, 0a, 00, 0b, 9f, 01, 01, 09, 00, 17, 31, 02, 09, 00, 0f, 9b, 01, 03, 08, 00, 0c, 5d, 01, 0d, 01, 10, 61, 01, 11, 02, 0a, 00, 02, 0a, 00, 0b, e3, 01, 02, 0c, 00, 19, 65, 00, 1a, 02, 0a, de, 01, 03, 11, 00, 1e, da, 01, 01, 10, 00, 1d, d6, 01, 00, 21, 00, 2e, d2, 01, 00, 32, 00, 40, 87, 02, 00, 41, 02, 0e, 75, 02, 0e, 00, 0f, 83, 02, 01, 0d, 00, 1b, 2d, 02, 0d, 00, 13, 00, 02, 06, 00, 07, fb, 01, 02, 09, 01, 0c, 79, 01, 0d, 02, 06, 00, 02, 06, 00, 07, e7, 03, 02, 09, 00, 0a, d7, 02, 00, 10, 00, 1d, 7d, 00, 1e, 02, 06, d2, 02, 02, 0f, 00, 1c, ce, 02, 01, 0c, 00, 19, ca, 02, 00, 1d, 00, 2a, c6, 02, 00, 2e, 00, 3c, ef, 03, 00, 3d, 02, 0a, 8d, 01, 02, 0a, 00, 0b, eb, 03, 01, 09, 00, 17, 29, 02, 0d, 02, 0f, 8f, 04, 05, 09, 00, 0a, e7, 03, 00, 10, 00, 1d, 11, 00, 1e, 02, 06, e2, 03, 02, 0f, 00, 1c, de, 03, 01, 0c, 00, 19, da, 03, 00, 1d, 00, 2a, d6, 03, 00, 2e, 00, 3c, 97, 04, 00, 3d, 02, 0a, 21, 02, 0a, 00, 0b, 93, 04, 01, 09, 00, 17, 25, 02, 09, 00, 0f, 8b, 04, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 142
@@ -139,9 +139,9 @@ Number of expressions: 142
- expression 133 operands: lhs = Expression(134, Add), rhs = Counter(7)
- expression 134 operands: lhs = Counter(5), rhs = Counter(6)
- expression 135 operands: lhs = Expression(136, Add), rhs = Expression(139, Sub)
-- expression 136 operands: lhs = Expression(137, Add), rhs = Expression(138, Add)
-- expression 137 operands: lhs = Counter(9), rhs = Counter(10)
-- expression 138 operands: lhs = Counter(11), rhs = Counter(12)
+- expression 136 operands: lhs = Expression(137, Add), rhs = Counter(12)
+- expression 137 operands: lhs = Expression(138, Add), rhs = Counter(11)
+- expression 138 operands: lhs = Counter(9), rhs = Counter(10)
- expression 139 operands: lhs = Expression(140, Sub), rhs = Counter(3)
- expression 140 operands: lhs = Expression(141, Add), rhs = Counter(2)
- expression 141 operands: lhs = Counter(1), rhs = Zero
@@ -255,5 +255,5 @@ Number of file 0 mappings: 68
= (((c5 + c6) + c7) + c8)
- Code(Counter(9)) at (prev + 2, 9) to (start + 0, 15)
- Code(Expression(130, Add)) at (prev + 2, 1) to (start + 0, 2)
- = ((c4 + (((c5 + c6) + c7) + c8)) + (((c9 + c10) + (c11 + c12)) + (((c1 + Zero) - c2) - c3)))
+ = ((c4 + (((c5 + c6) + c7) + c8)) + ((((c9 + c10) + c11) + c12) + (((c1 + Zero) - c2) - c3)))
diff --git a/tests/coverage/continue.cov-map b/tests/coverage/continue.cov-map
index 82f3d7c60..810694d7f 100644
--- a/tests/coverage/continue.cov-map
+++ b/tests/coverage/continue.cov-map
@@ -1,26 +1,26 @@
Function name: continue::main
-Raw bytes (210): 0x[01, 01, 1c, 01, 07, 05, 09, 03, 0d, 0d, 1f, 11, 15, 1b, 19, 0d, 1f, 11, 15, 19, 33, 1d, 21, 2f, 25, 19, 33, 1d, 21, 25, 47, 29, 2d, 43, 31, 25, 47, 29, 2d, 31, 5f, 35, 39, 57, 3d, 31, 5f, 35, 39, 35, 39, 3d, 41, 6b, 45, 3d, 41, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02]
+Raw bytes (210): 0x[01, 01, 1c, 07, 09, 01, 05, 03, 0d, 1f, 15, 0d, 11, 1b, 19, 1f, 15, 0d, 11, 33, 21, 19, 1d, 2f, 25, 33, 21, 19, 1d, 47, 2d, 25, 29, 43, 31, 47, 2d, 25, 29, 31, 5f, 35, 39, 57, 3d, 31, 5f, 35, 39, 35, 39, 3d, 41, 6b, 45, 3d, 41, 49, 45, 1e, 01, 03, 01, 03, 12, 03, 04, 0e, 00, 13, 0a, 01, 0f, 00, 16, 05, 02, 11, 00, 19, 09, 02, 12, 04, 0e, 1b, 06, 0e, 00, 13, 16, 01, 0f, 00, 16, 15, 01, 16, 02, 0e, 11, 04, 11, 00, 19, 15, 03, 09, 00, 0e, 2f, 02, 0e, 00, 13, 2a, 01, 0f, 00, 16, 1d, 01, 15, 02, 0e, 21, 04, 11, 00, 19, 1d, 03, 09, 00, 0e, 43, 02, 0e, 00, 13, 3e, 01, 0c, 00, 13, 29, 01, 0d, 00, 15, 2d, 01, 0a, 01, 0e, 57, 03, 0e, 00, 13, 52, 01, 0f, 00, 16, 39, 01, 16, 02, 0e, 35, 03, 12, 02, 0e, 5f, 04, 09, 00, 0e, 6b, 02, 0e, 00, 13, 66, 01, 0f, 00, 16, 41, 01, 16, 02, 0e, 49, 04, 11, 00, 16, 41, 03, 09, 00, 0e, 6f, 02, 0d, 01, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 28
-- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(2)
+- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
-- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Add)
-- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
+- expression 3 operands: lhs = Expression(7, Add), rhs = Counter(5)
+- expression 4 operands: lhs = Counter(3), rhs = Counter(4)
- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(6)
-- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Add)
-- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
-- expression 8 operands: lhs = Counter(6), rhs = Expression(12, Add)
-- expression 9 operands: lhs = Counter(7), rhs = Counter(8)
+- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(5)
+- expression 7 operands: lhs = Counter(3), rhs = Counter(4)
+- expression 8 operands: lhs = Expression(12, Add), rhs = Counter(8)
+- expression 9 operands: lhs = Counter(6), rhs = Counter(7)
- expression 10 operands: lhs = Expression(11, Add), rhs = Counter(9)
-- expression 11 operands: lhs = Counter(6), rhs = Expression(12, Add)
-- expression 12 operands: lhs = Counter(7), rhs = Counter(8)
-- expression 13 operands: lhs = Counter(9), rhs = Expression(17, Add)
-- expression 14 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 11 operands: lhs = Expression(12, Add), rhs = Counter(8)
+- expression 12 operands: lhs = Counter(6), rhs = Counter(7)
+- expression 13 operands: lhs = Expression(17, Add), rhs = Counter(11)
+- expression 14 operands: lhs = Counter(9), rhs = Counter(10)
- expression 15 operands: lhs = Expression(16, Add), rhs = Counter(12)
-- expression 16 operands: lhs = Counter(9), rhs = Expression(17, Add)
-- expression 17 operands: lhs = Counter(10), rhs = Counter(11)
+- expression 16 operands: lhs = Expression(17, Add), rhs = Counter(11)
+- expression 17 operands: lhs = Counter(9), rhs = Counter(10)
- expression 18 operands: lhs = Counter(12), rhs = Expression(23, Add)
- expression 19 operands: lhs = Counter(13), rhs = Counter(14)
- expression 20 operands: lhs = Expression(21, Add), rhs = Counter(15)
@@ -34,29 +34,29 @@ Number of expressions: 28
Number of file 0 mappings: 30
- Code(Counter(0)) at (prev + 3, 1) to (start + 3, 18)
- Code(Expression(0, Add)) at (prev + 4, 14) to (start + 0, 19)
- = (c0 + (c1 + c2))
+ = ((c0 + c1) + c2)
- Code(Expression(2, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c0 + (c1 + c2)) - c3)
+ = (((c0 + c1) + c2) - c3)
- Code(Counter(1)) at (prev + 2, 17) to (start + 0, 25)
- Code(Counter(2)) at (prev + 2, 18) to (start + 4, 14)
- Code(Expression(6, Add)) at (prev + 6, 14) to (start + 0, 19)
- = (c3 + (c4 + c5))
+ = ((c3 + c4) + c5)
- Code(Expression(5, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c3 + (c4 + c5)) - c6)
+ = (((c3 + c4) + c5) - c6)
- Code(Counter(5)) at (prev + 1, 22) to (start + 2, 14)
- Code(Counter(4)) at (prev + 4, 17) to (start + 0, 25)
- Code(Counter(5)) at (prev + 3, 9) to (start + 0, 14)
- Code(Expression(11, Add)) at (prev + 2, 14) to (start + 0, 19)
- = (c6 + (c7 + c8))
+ = ((c6 + c7) + c8)
- Code(Expression(10, Sub)) at (prev + 1, 15) to (start + 0, 22)
- = ((c6 + (c7 + c8)) - c9)
+ = (((c6 + c7) + c8) - c9)
- Code(Counter(7)) at (prev + 1, 21) to (start + 2, 14)
- Code(Counter(8)) at (prev + 4, 17) to (start + 0, 25)
- Code(Counter(7)) at (prev + 3, 9) to (start + 0, 14)
- Code(Expression(16, Add)) at (prev + 2, 14) to (start + 0, 19)
- = (c9 + (c10 + c11))
+ = ((c9 + c10) + c11)
- Code(Expression(15, Sub)) at (prev + 1, 12) to (start + 0, 19)
- = ((c9 + (c10 + c11)) - c12)
+ = (((c9 + c10) + c11) - c12)
- Code(Counter(10)) at (prev + 1, 13) to (start + 0, 21)
- Code(Counter(11)) at (prev + 1, 10) to (start + 1, 14)
- Code(Expression(21, Add)) at (prev + 3, 14) to (start + 0, 19)
diff --git a/tests/coverage/coroutine.cov-map b/tests/coverage/coroutine.cov-map
index 2f4936d9a..8dd03acc2 100644
--- a/tests/coverage/coroutine.cov-map
+++ b/tests/coverage/coroutine.cov-map
@@ -14,12 +14,12 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: coroutine::main
-Raw bytes (65): 0x[01, 01, 08, 05, 07, 09, 0d, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 01, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
+Raw bytes (65): 0x[01, 01, 08, 07, 0d, 05, 09, 11, 15, 1e, 19, 11, 15, 15, 19, 1e, 19, 11, 15, 09, 01, 0f, 01, 02, 16, 01, 07, 0b, 00, 2e, 11, 01, 2b, 00, 2d, 03, 01, 0e, 00, 35, 11, 02, 0b, 00, 2e, 1e, 01, 22, 00, 27, 1a, 00, 2c, 00, 2e, 17, 01, 0e, 00, 35, 1a, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 8
-- expression 0 operands: lhs = Counter(1), rhs = Expression(1, Add)
-- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
+- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
+- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
- expression 2 operands: lhs = Counter(4), rhs = Counter(5)
- expression 3 operands: lhs = Expression(7, Sub), rhs = Counter(6)
- expression 4 operands: lhs = Counter(4), rhs = Counter(5)
@@ -31,7 +31,7 @@ Number of file 0 mappings: 9
- Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46)
- Code(Counter(4)) at (prev + 1, 43) to (start + 0, 45)
- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 53)
- = (c1 + (c2 + c3))
+ = ((c1 + c2) + c3)
- Code(Counter(4)) at (prev + 2, 11) to (start + 0, 46)
- Code(Expression(7, Sub)) at (prev + 1, 34) to (start + 0, 39)
= (c4 - c5)
diff --git a/tests/coverage/if_not.cov-map b/tests/coverage/if_not.cov-map
new file mode 100644
index 000000000..fb893e379
--- /dev/null
+++ b/tests/coverage/if_not.cov-map
@@ -0,0 +1,39 @@
+Function name: if_not::if_not
+Raw bytes (86): 0x[01, 01, 10, 01, 05, 05, 02, 3f, 09, 05, 02, 09, 3a, 3f, 09, 05, 02, 37, 0d, 09, 3a, 3f, 09, 05, 02, 0d, 32, 37, 0d, 09, 3a, 3f, 09, 05, 02, 0a, 01, 04, 01, 03, 0d, 02, 04, 05, 02, 06, 05, 02, 06, 00, 07, 3f, 03, 09, 01, 0d, 3a, 02, 05, 02, 06, 09, 02, 06, 00, 07, 37, 03, 09, 01, 0d, 32, 02, 05, 02, 06, 0d, 02, 0c, 02, 06, 2f, 03, 01, 00, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 16
+- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
+- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 2 operands: lhs = Expression(15, Add), rhs = Counter(2)
+- expression 3 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 4 operands: lhs = Counter(2), rhs = Expression(14, Sub)
+- expression 5 operands: lhs = Expression(15, Add), rhs = Counter(2)
+- expression 6 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 7 operands: lhs = Expression(13, Add), rhs = Counter(3)
+- expression 8 operands: lhs = Counter(2), rhs = Expression(14, Sub)
+- expression 9 operands: lhs = Expression(15, Add), rhs = Counter(2)
+- expression 10 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+- expression 11 operands: lhs = Counter(3), rhs = Expression(12, Sub)
+- expression 12 operands: lhs = Expression(13, Add), rhs = Counter(3)
+- expression 13 operands: lhs = Counter(2), rhs = Expression(14, Sub)
+- expression 14 operands: lhs = Expression(15, Add), rhs = Counter(2)
+- expression 15 operands: lhs = Counter(1), rhs = Expression(0, Sub)
+Number of file 0 mappings: 10
+- Code(Counter(0)) at (prev + 4, 1) to (start + 3, 13)
+- Code(Expression(0, Sub)) at (prev + 4, 5) to (start + 2, 6)
+ = (c0 - c1)
+- Code(Counter(1)) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(15, Add)) at (prev + 3, 9) to (start + 1, 13)
+ = (c1 + (c0 - c1))
+- Code(Expression(14, Sub)) at (prev + 2, 5) to (start + 2, 6)
+ = ((c1 + (c0 - c1)) - c2)
+- Code(Counter(2)) at (prev + 2, 6) to (start + 0, 7)
+- Code(Expression(13, Add)) at (prev + 3, 9) to (start + 1, 13)
+ = (c2 + ((c1 + (c0 - c1)) - c2))
+- Code(Expression(12, Sub)) at (prev + 2, 5) to (start + 2, 6)
+ = ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)
+- Code(Counter(3)) at (prev + 2, 12) to (start + 2, 6)
+- Code(Expression(11, Add)) at (prev + 3, 1) to (start + 0, 2)
+ = (c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3))
+
diff --git a/tests/coverage/if_not.coverage b/tests/coverage/if_not.coverage
new file mode 100644
index 000000000..41838b851
--- /dev/null
+++ b/tests/coverage/if_not.coverage
@@ -0,0 +1,38 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |// edition: 2021
+ LL| |
+ LL| 12|fn if_not(cond: bool) {
+ LL| 12| if
+ LL| 12| !
+ LL| 12| cond
+ LL| 4| {
+ LL| 4| println!("cond was false");
+ LL| 8| }
+ LL| |
+ LL| | if
+ LL| 12| !
+ LL| 12| cond
+ LL| 4| {
+ LL| 4| println!("cond was false");
+ LL| 8| }
+ LL| |
+ LL| | if
+ LL| 12| !
+ LL| 12| cond
+ LL| 4| {
+ LL| 4| println!("cond was false");
+ LL| 8| } else {
+ LL| 8| println!("cond was true");
+ LL| 8| }
+ LL| 12|}
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | for _ in 0..8 {
+ LL| | if_not(std::hint::black_box(true));
+ LL| | }
+ LL| | for _ in 0..4 {
+ LL| | if_not(std::hint::black_box(false));
+ LL| | }
+ LL| |}
+
diff --git a/tests/coverage/if_not.rs b/tests/coverage/if_not.rs
new file mode 100644
index 000000000..4f45ae0b3
--- /dev/null
+++ b/tests/coverage/if_not.rs
@@ -0,0 +1,37 @@
+#![feature(coverage_attribute)]
+// edition: 2021
+
+fn if_not(cond: bool) {
+ if
+ !
+ cond
+ {
+ println!("cond was false");
+ }
+
+ if
+ !
+ cond
+ {
+ println!("cond was false");
+ }
+
+ if
+ !
+ cond
+ {
+ println!("cond was false");
+ } else {
+ println!("cond was true");
+ }
+}
+
+#[coverage(off)]
+fn main() {
+ for _ in 0..8 {
+ if_not(std::hint::black_box(true));
+ }
+ for _ in 0..4 {
+ if_not(std::hint::black_box(false));
+ }
+}
diff --git a/tests/coverage/inline.cov-map b/tests/coverage/inline.cov-map
index 72b10fd0c..001c333ae 100644
--- a/tests/coverage/inline.cov-map
+++ b/tests/coverage/inline.cov-map
@@ -15,12 +15,12 @@ Number of file 0 mappings: 5
= ((c0 + c1) - c1)
Function name: inline::error
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 31, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 31, 01, 01, 14]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 49, 1) to (start + 2, 2)
+- Code(Counter(0)) at (prev + 49, 1) to (start + 1, 20)
Function name: inline::length::<char>
Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 01, 02, 02]
diff --git a/tests/coverage/inline.coverage b/tests/coverage/inline.coverage
index 6efd9a083..68a2e4083 100644
--- a/tests/coverage/inline.coverage
+++ b/tests/coverage/inline.coverage
@@ -50,5 +50,5 @@
LL| |#[inline(always)]
LL| 0|fn error() {
LL| 0| panic!("error");
- LL| 0|}
+ LL| |}
diff --git a/tests/coverage/lazy_boolean.cov-map b/tests/coverage/lazy_boolean.cov-map
index 0ad393c40..2d1ff24e6 100644
--- a/tests/coverage/lazy_boolean.cov-map
+++ b/tests/coverage/lazy_boolean.cov-map
@@ -1,5 +1,5 @@
Function name: lazy_boolean::main
-Raw bytes (636): 0x[01, 01, a4, 01, 01, 05, 09, 8a, 05, 8f, 05, 09, 05, 02, 05, 02, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 09, 8a, 05, 8f, 05, 09, 05, 02, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 25, d2, 04, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1c, 01, 03, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 06, 00, 07, 87, 05, 02, 09, 00, 11, 8f, 05, 02, 0d, 00, 12, 8a, 05, 02, 0d, 00, 12, ff, 04, 03, 09, 00, 11, 87, 05, 02, 0d, 00, 12, 82, 05, 02, 0d, 00, 12, f7, 04, 02, 09, 00, 11, ff, 04, 00, 14, 00, 19, 11, 00, 1d, 00, 22, ef, 04, 01, 09, 00, 11, f7, 04, 00, 14, 00, 19, 15, 00, 1d, 00, 22, ef, 04, 04, 09, 00, 10, ea, 04, 01, 05, 03, 06, 19, 03, 06, 00, 07, e7, 04, 03, 09, 00, 10, 1d, 01, 05, 03, 06, e2, 04, 05, 05, 03, 06, df, 04, 05, 09, 00, 10, da, 04, 00, 11, 02, 06, 21, 02, 06, 00, 07, d7, 04, 02, 08, 00, 0f, 25, 00, 10, 02, 06, d2, 04, 02, 0c, 02, 06, cf, 04, 03, 01, 00, 02]
+Raw bytes (636): 0x[01, 01, a4, 01, 01, 05, 09, 8a, 05, 8f, 05, 09, 05, 02, 05, 02, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 09, 8a, 05, 8f, 05, 09, 05, 02, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 25, d2, 04, d7, 04, 25, 21, da, 04, df, 04, 21, 1d, e2, 04, e7, 04, 1d, 19, ea, 04, ef, 04, 19, 15, f2, 04, f7, 04, 15, 11, fa, 04, ff, 04, 11, 0d, 82, 05, 87, 05, 0d, 09, 8a, 05, 8f, 05, 09, 05, 02, 1c, 01, 03, 01, 07, 0f, 05, 07, 10, 04, 06, 02, 04, 06, 00, 07, 87, 05, 02, 09, 00, 11, 8f, 05, 02, 0d, 00, 12, 8a, 05, 02, 0d, 00, 12, ff, 04, 03, 09, 00, 11, 87, 05, 02, 0d, 00, 12, 82, 05, 02, 0d, 00, 12, f7, 04, 02, 09, 00, 11, ff, 04, 00, 14, 00, 19, 11, 00, 1d, 00, 22, ef, 04, 01, 09, 00, 11, f7, 04, 00, 14, 00, 19, 15, 00, 1d, 00, 22, ef, 04, 03, 09, 01, 10, ea, 04, 02, 05, 03, 06, 19, 03, 06, 00, 07, e7, 04, 03, 09, 00, 10, 1d, 01, 05, 03, 06, e2, 04, 05, 05, 03, 06, df, 04, 05, 08, 00, 10, da, 04, 00, 11, 02, 06, 21, 02, 06, 00, 07, d7, 04, 02, 08, 00, 0f, 25, 00, 10, 02, 06, d2, 04, 02, 0c, 02, 06, cf, 04, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 164
@@ -194,9 +194,9 @@ Number of file 0 mappings: 28
- Code(Expression(157, Add)) at (prev + 0, 20) to (start + 0, 25)
= (c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4))
- Code(Counter(5)) at (prev + 0, 29) to (start + 0, 34)
-- Code(Expression(155, Add)) at (prev + 4, 9) to (start + 0, 16)
+- Code(Expression(155, Add)) at (prev + 3, 9) to (start + 1, 16)
= (c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5))
-- Code(Expression(154, Sub)) at (prev + 1, 5) to (start + 3, 6)
+- Code(Expression(154, Sub)) at (prev + 2, 5) to (start + 3, 6)
= ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)
- Code(Counter(6)) at (prev + 3, 6) to (start + 0, 7)
- Code(Expression(153, Add)) at (prev + 3, 9) to (start + 0, 16)
@@ -204,7 +204,7 @@ Number of file 0 mappings: 28
- Code(Counter(7)) at (prev + 1, 5) to (start + 3, 6)
- Code(Expression(152, Sub)) at (prev + 5, 5) to (start + 3, 6)
= ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)
-- Code(Expression(151, Add)) at (prev + 5, 9) to (start + 0, 16)
+- Code(Expression(151, Add)) at (prev + 5, 8) to (start + 0, 16)
= (c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7))
- Code(Expression(150, Sub)) at (prev + 0, 17) to (start + 2, 6)
= ((c7 + ((c6 + ((c5 + ((c4 + ((c3 + ((c2 + ((c1 + (c0 - c1)) - c2)) - c3)) - c4)) - c5)) - c6)) - c7)) - c8)
diff --git a/tests/coverage/lazy_boolean.coverage b/tests/coverage/lazy_boolean.coverage
index 8f14082ef..2d927a083 100644
--- a/tests/coverage/lazy_boolean.coverage
+++ b/tests/coverage/lazy_boolean.coverage
@@ -32,7 +32,7 @@
^0
LL| |
LL| | if
- LL| | !
+ LL| 1| !
LL| 1| is_true
LL| 0| {
LL| 0| a = 2
diff --git a/tests/coverage/loops_branches.cov-map b/tests/coverage/loops_branches.cov-map
index 813583a9d..8dc353211 100644
--- a/tests/coverage/loops_branches.cov-map
+++ b/tests/coverage/loops_branches.cov-map
@@ -1,5 +1,5 @@
Function name: <loops_branches::DebugTest as core::fmt::Debug>::fmt
-Raw bytes (249): 0x[01, 01, 31, 05, 00, 00, 02, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, bf, 01, c3, 01, 0d, 00, 11, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 25, a3, 01, a6, 01, 19, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0e, 00, 0f, 07, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, b6, 01, 03, 0d, 00, 0e, bb, 01, 00, 12, 00, 17, b6, 01, 01, 10, 00, 14, b2, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, ae, 01, 01, 12, 00, 13, ab, 01, 01, 11, 00, 22, a6, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 9f, 01, 01, 05, 00, 06]
+Raw bytes (249): 0x[01, 01, 31, 05, 00, 00, 02, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, bf, 01, c3, 01, 0d, 00, 11, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, a3, 01, 19, 25, a6, 01, ab, 01, 11, 00, ae, 01, b2, 01, 00, b6, 01, 00, bb, 01, 19, bf, 01, c3, 01, 0d, 00, 11, 00, 14, 01, 09, 05, 01, 10, 05, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 02, 01, 0e, 00, 0f, 07, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, 00, 01, 10, 01, 0a, b6, 01, 03, 0d, 00, 0e, bb, 01, 00, 12, 00, 17, b6, 01, 01, 10, 00, 14, b2, 01, 01, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, ae, 01, 01, 12, 00, 13, ab, 01, 01, 11, 00, 22, a6, 01, 00, 22, 00, 23, 00, 01, 14, 01, 0e, 19, 03, 09, 00, 0f, 9f, 01, 01, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 49
@@ -42,8 +42,8 @@ Number of expressions: 49
- expression 36 operands: lhs = Expression(47, Add), rhs = Expression(48, Add)
- expression 37 operands: lhs = Counter(3), rhs = Zero
- expression 38 operands: lhs = Counter(4), rhs = Zero
-- expression 39 operands: lhs = Counter(9), rhs = Expression(40, Add)
-- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(6)
+- expression 39 operands: lhs = Expression(40, Add), rhs = Counter(6)
+- expression 40 operands: lhs = Counter(9), rhs = Expression(41, Sub)
- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(4)
- expression 42 operands: lhs = Zero, rhs = Expression(43, Sub)
- expression 43 operands: lhs = Expression(44, Sub), rhs = Zero
@@ -82,10 +82,10 @@ Number of file 0 mappings: 20
- Code(Zero) at (prev + 1, 20) to (start + 1, 14)
- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
- Code(Expression(39, Add)) at (prev + 1, 5) to (start + 0, 6)
- = (c9 + (((Zero + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)) - c4) + c6))
+ = ((c9 + ((Zero + (((((c3 + Zero) + (c4 + Zero)) - c6) - Zero) - Zero)) - c4)) + c6)
Function name: <loops_branches::DisplayTest as core::fmt::Display>::fmt
-Raw bytes (253): 0x[01, 01, 33, 01, 00, 02, 00, 00, 0e, 02, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, c3, 01, c7, 01, 00, 0d, 00, 15, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, af, 01, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, aa, 01, cb, 01, af, 01, 15, 00, b2, 01, b6, 01, 00, ba, 01, 00, bf, 01, 19, c3, 01, c7, 01, 00, 0d, 00, 15, 19, 25, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 0e, 01, 0e, 00, 0f, 0b, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, ba, 01, 02, 0d, 00, 0e, bf, 01, 00, 12, 00, 17, ba, 01, 01, 10, 00, 15, 00, 00, 16, 01, 0e, b6, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b2, 01, 01, 12, 00, 13, af, 01, 01, 11, 00, 22, aa, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, a7, 01, 01, 05, 00, 06]
+Raw bytes (253): 0x[01, 01, 33, 01, 00, 02, 00, 00, 0e, 02, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, c7, 01, cb, 01, 00, 0d, 00, 15, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, ba, 01, 00, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, 00, b6, 01, ba, 01, 00, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, b3, 01, 15, 00, b6, 01, ba, 01, 00, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, ab, 01, 25, ae, 01, 19, b3, 01, 15, 00, b6, 01, ba, 01, 00, be, 01, 00, c3, 01, 19, c7, 01, cb, 01, 00, 0d, 00, 15, 14, 01, 22, 05, 01, 11, 00, 01, 12, 01, 0a, 02, 02, 10, 00, 15, 00, 01, 17, 00, 1b, 00, 00, 1c, 00, 1e, 0e, 01, 0e, 00, 0f, 0b, 01, 0d, 00, 1e, 25, 00, 1e, 00, 1f, be, 01, 02, 0d, 00, 0e, c3, 01, 00, 12, 00, 17, be, 01, 01, 10, 00, 15, 00, 00, 16, 01, 0e, ba, 01, 02, 14, 00, 19, 00, 01, 1b, 00, 1f, 00, 00, 20, 00, 22, b6, 01, 01, 12, 00, 13, b3, 01, 01, 11, 00, 22, ae, 01, 00, 22, 00, 23, 19, 03, 09, 00, 0f, a7, 01, 01, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 51
@@ -93,53 +93,53 @@ Number of expressions: 51
- expression 1 operands: lhs = Expression(0, Sub), rhs = Zero
- expression 2 operands: lhs = Zero, rhs = Expression(3, Sub)
- expression 3 operands: lhs = Expression(0, Sub), rhs = Zero
-- expression 4 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 5 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 4 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 5 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 6 operands: lhs = Zero, rhs = Counter(3)
- expression 7 operands: lhs = Zero, rhs = Counter(5)
-- expression 8 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 8 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 9 operands: lhs = Zero, rhs = Counter(3)
- expression 10 operands: lhs = Zero, rhs = Counter(5)
-- expression 11 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 12 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 11 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 12 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 13 operands: lhs = Zero, rhs = Counter(3)
- expression 14 operands: lhs = Zero, rhs = Counter(5)
-- expression 15 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 16 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 17 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 15 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 16 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 17 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 18 operands: lhs = Zero, rhs = Counter(3)
- expression 19 operands: lhs = Zero, rhs = Counter(5)
-- expression 20 operands: lhs = Expression(45, Sub), rhs = Zero
-- expression 21 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 22 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 23 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 20 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 21 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 22 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 23 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 24 operands: lhs = Zero, rhs = Counter(3)
- expression 25 operands: lhs = Zero, rhs = Counter(5)
-- expression 26 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 27 operands: lhs = Expression(45, Sub), rhs = Zero
-- expression 28 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 29 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 30 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 26 operands: lhs = Zero, rhs = Expression(45, Sub)
+- expression 27 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 28 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 29 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 30 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 31 operands: lhs = Zero, rhs = Counter(3)
- expression 32 operands: lhs = Zero, rhs = Counter(5)
-- expression 33 operands: lhs = Expression(43, Add), rhs = Counter(5)
-- expression 34 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 35 operands: lhs = Expression(45, Sub), rhs = Zero
-- expression 36 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 37 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 38 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
+- expression 33 operands: lhs = Expression(44, Add), rhs = Counter(5)
+- expression 34 operands: lhs = Zero, rhs = Expression(45, Sub)
+- expression 35 operands: lhs = Expression(46, Sub), rhs = Zero
+- expression 36 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 37 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 38 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
- expression 39 operands: lhs = Zero, rhs = Counter(3)
- expression 40 operands: lhs = Zero, rhs = Counter(5)
-- expression 41 operands: lhs = Expression(42, Sub), rhs = Expression(50, Add)
-- expression 42 operands: lhs = Expression(43, Add), rhs = Counter(5)
-- expression 43 operands: lhs = Zero, rhs = Expression(44, Sub)
-- expression 44 operands: lhs = Expression(45, Sub), rhs = Zero
+- expression 41 operands: lhs = Expression(42, Add), rhs = Counter(9)
+- expression 42 operands: lhs = Expression(43, Sub), rhs = Counter(6)
+- expression 43 operands: lhs = Expression(44, Add), rhs = Counter(5)
+- expression 44 operands: lhs = Zero, rhs = Expression(45, Sub)
- expression 45 operands: lhs = Expression(46, Sub), rhs = Zero
-- expression 46 operands: lhs = Expression(47, Add), rhs = Counter(6)
-- expression 47 operands: lhs = Expression(48, Add), rhs = Expression(49, Add)
-- expression 48 operands: lhs = Zero, rhs = Counter(3)
-- expression 49 operands: lhs = Zero, rhs = Counter(5)
-- expression 50 operands: lhs = Counter(6), rhs = Counter(9)
+- expression 46 operands: lhs = Expression(47, Sub), rhs = Zero
+- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(6)
+- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(50, Add)
+- expression 49 operands: lhs = Zero, rhs = Counter(3)
+- expression 50 operands: lhs = Zero, rhs = Counter(5)
Number of file 0 mappings: 20
- Code(Counter(0)) at (prev + 34, 5) to (start + 1, 17)
- Code(Zero) at (prev + 1, 18) to (start + 1, 10)
@@ -152,26 +152,26 @@ Number of file 0 mappings: 20
- Code(Expression(2, Add)) at (prev + 1, 13) to (start + 0, 30)
= (Zero + ((c0 - Zero) - Zero))
- Code(Counter(9)) at (prev + 0, 30) to (start + 0, 31)
-- Code(Expression(46, Sub)) at (prev + 2, 13) to (start + 0, 14)
+- Code(Expression(47, Sub)) at (prev + 2, 13) to (start + 0, 14)
= (((Zero + c3) + (Zero + c5)) - c6)
-- Code(Expression(47, Add)) at (prev + 0, 18) to (start + 0, 23)
+- Code(Expression(48, Add)) at (prev + 0, 18) to (start + 0, 23)
= ((Zero + c3) + (Zero + c5))
-- Code(Expression(46, Sub)) at (prev + 1, 16) to (start + 0, 21)
+- Code(Expression(47, Sub)) at (prev + 1, 16) to (start + 0, 21)
= (((Zero + c3) + (Zero + c5)) - c6)
- Code(Zero) at (prev + 0, 22) to (start + 1, 14)
-- Code(Expression(45, Sub)) at (prev + 2, 20) to (start + 0, 25)
+- Code(Expression(46, Sub)) at (prev + 2, 20) to (start + 0, 25)
= ((((Zero + c3) + (Zero + c5)) - c6) - Zero)
- Code(Zero) at (prev + 1, 27) to (start + 0, 31)
- Code(Zero) at (prev + 0, 32) to (start + 0, 34)
-- Code(Expression(44, Sub)) at (prev + 1, 18) to (start + 0, 19)
+- Code(Expression(45, Sub)) at (prev + 1, 18) to (start + 0, 19)
= (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)
-- Code(Expression(43, Add)) at (prev + 1, 17) to (start + 0, 34)
+- Code(Expression(44, Add)) at (prev + 1, 17) to (start + 0, 34)
= (Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero))
-- Code(Expression(42, Sub)) at (prev + 0, 34) to (start + 0, 35)
+- Code(Expression(43, Sub)) at (prev + 0, 34) to (start + 0, 35)
= ((Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)) - c5)
- Code(Counter(6)) at (prev + 3, 9) to (start + 0, 15)
- Code(Expression(41, Add)) at (prev + 1, 5) to (start + 0, 6)
- = (((Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)) - c5) + (c6 + c9))
+ = ((((Zero + (((((Zero + c3) + (Zero + c5)) - c6) - Zero) - Zero)) - c5) + c6) + c9)
Function name: loops_branches::main
Raw bytes (9): 0x[01, 01, 00, 01, 01, 37, 01, 05, 02]
diff --git a/tests/coverage/no_spans.cov-map b/tests/coverage/no_spans.cov-map
new file mode 100644
index 000000000..9915fc52e
--- /dev/null
+++ b/tests/coverage/no_spans.cov-map
@@ -0,0 +1,8 @@
+Function name: no_spans::affected_function::{closure#0}
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 1b, 0c, 00, 0e]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 27, 12) to (start + 0, 14)
+
diff --git a/tests/coverage/no_spans.coverage b/tests/coverage/no_spans.coverage
new file mode 100644
index 000000000..e55177698
--- /dev/null
+++ b/tests/coverage/no_spans.coverage
@@ -0,0 +1,30 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |// edition: 2021
+ LL| |
+ LL| |// If the span extractor can't find any relevant spans for a function, the
+ LL| |// refinement loop will terminate with nothing in its `prev` slot. If the
+ LL| |// subsequent code tries to unwrap `prev`, it will panic.
+ LL| |//
+ LL| |// This scenario became more likely after #118525 started discarding spans that
+ LL| |// can't be un-expanded back to within the function body.
+ LL| |//
+ LL| |// Regression test for "invalid attempt to unwrap a None some_prev", as seen
+ LL| |// in issues such as #118643 and #118662.
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | affected_function()();
+ LL| |}
+ LL| |
+ LL| |macro_rules! macro_that_defines_a_function {
+ LL| | (fn $name:ident () $body:tt) => {
+ LL| | fn $name () -> impl Fn() $body
+ LL| | }
+ LL| |}
+ LL| |
+ LL| |macro_that_defines_a_function! {
+ LL| | fn affected_function() {
+ LL| 1| || ()
+ LL| | }
+ LL| |}
+
diff --git a/tests/coverage/no_spans.rs b/tests/coverage/no_spans.rs
new file mode 100644
index 000000000..a5234bc6b
--- /dev/null
+++ b/tests/coverage/no_spans.rs
@@ -0,0 +1,29 @@
+#![feature(coverage_attribute)]
+// edition: 2021
+
+// If the span extractor can't find any relevant spans for a function, the
+// refinement loop will terminate with nothing in its `prev` slot. If the
+// subsequent code tries to unwrap `prev`, it will panic.
+//
+// This scenario became more likely after #118525 started discarding spans that
+// can't be un-expanded back to within the function body.
+//
+// Regression test for "invalid attempt to unwrap a None some_prev", as seen
+// in issues such as #118643 and #118662.
+
+#[coverage(off)]
+fn main() {
+ affected_function()();
+}
+
+macro_rules! macro_that_defines_a_function {
+ (fn $name:ident () $body:tt) => {
+ fn $name () -> impl Fn() $body
+ }
+}
+
+macro_that_defines_a_function! {
+ fn affected_function() {
+ || ()
+ }
+}
diff --git a/tests/coverage/no_spans_if_not.cov-map b/tests/coverage/no_spans_if_not.cov-map
new file mode 100644
index 000000000..5277267ec
--- /dev/null
+++ b/tests/coverage/no_spans_if_not.cov-map
@@ -0,0 +1,8 @@
+Function name: no_spans_if_not::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0b, 01, 02, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 11, 1) to (start + 2, 2)
+
diff --git a/tests/coverage/no_spans_if_not.coverage b/tests/coverage/no_spans_if_not.coverage
new file mode 100644
index 000000000..1b6bbc75a
--- /dev/null
+++ b/tests/coverage/no_spans_if_not.coverage
@@ -0,0 +1,30 @@
+ LL| |// edition: 2021
+ LL| |
+ LL| |// If the span extractor can't find any relevant spans for a function,
+ LL| |// but the function contains coverage span-marker statements (e.g. inserted
+ LL| |// for `if !`), coverage codegen may think that it is instrumented and
+ LL| |// consequently complain that it has no spans.
+ LL| |//
+ LL| |// Regression test for <https://github.com/rust-lang/rust/issues/118850>,
+ LL| |// "A used function should have had coverage mapping data but did not".
+ LL| |
+ LL| 1|fn main() {
+ LL| 1| affected_function();
+ LL| 1|}
+ LL| |
+ LL| |macro_rules! macro_that_defines_a_function {
+ LL| | (fn $name:ident () $body:tt) => {
+ LL| | fn $name () $body
+ LL| | }
+ LL| |}
+ LL| |
+ LL| |macro_that_defines_a_function! {
+ LL| | fn affected_function() {
+ LL| | if !false {
+ LL| | ()
+ LL| | } else {
+ LL| | ()
+ LL| | }
+ LL| | }
+ LL| |}
+
diff --git a/tests/coverage/no_spans_if_not.rs b/tests/coverage/no_spans_if_not.rs
new file mode 100644
index 000000000..2bbdc11cd
--- /dev/null
+++ b/tests/coverage/no_spans_if_not.rs
@@ -0,0 +1,29 @@
+// edition: 2021
+
+// If the span extractor can't find any relevant spans for a function,
+// but the function contains coverage span-marker statements (e.g. inserted
+// for `if !`), coverage codegen may think that it is instrumented and
+// consequently complain that it has no spans.
+//
+// Regression test for <https://github.com/rust-lang/rust/issues/118850>,
+// "A used function should have had coverage mapping data but did not".
+
+fn main() {
+ affected_function();
+}
+
+macro_rules! macro_that_defines_a_function {
+ (fn $name:ident () $body:tt) => {
+ fn $name () $body
+ }
+}
+
+macro_that_defines_a_function! {
+ fn affected_function() {
+ if !false {
+ ()
+ } else {
+ ()
+ }
+ }
+}
diff --git a/tests/coverage/thin-lto.cov-map b/tests/coverage/thin-lto.cov-map
new file mode 100644
index 000000000..7e84e398f
--- /dev/null
+++ b/tests/coverage/thin-lto.cov-map
@@ -0,0 +1,8 @@
+Function name: thin_lto::main
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 03, 01, 01, 02]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 3, 1) to (start + 1, 2)
+
diff --git a/tests/coverage/thin-lto.coverage b/tests/coverage/thin-lto.coverage
new file mode 100644
index 000000000..21abb5dce
--- /dev/null
+++ b/tests/coverage/thin-lto.coverage
@@ -0,0 +1,5 @@
+ LL| |// compile-flags: -O -C lto=thin -C prefer-dynamic=no
+ LL| |
+ LL| 1|pub fn main() {
+ LL| 1|}
+
diff --git a/tests/coverage/thin-lto.rs b/tests/coverage/thin-lto.rs
new file mode 100644
index 000000000..050aac263
--- /dev/null
+++ b/tests/coverage/thin-lto.rs
@@ -0,0 +1,4 @@
+// compile-flags: -O -C lto=thin -C prefer-dynamic=no
+
+pub fn main() {
+}
diff --git a/tests/coverage/try_error_result.cov-map b/tests/coverage/try_error_result.cov-map
index 8367103a2..a9a18a180 100644
--- a/tests/coverage/try_error_result.cov-map
+++ b/tests/coverage/try_error_result.cov-map
@@ -59,7 +59,7 @@ Number of file 0 mappings: 4
= (c1 + (c0 - c1))
Function name: try_error_result::test1
-Raw bytes (77): 0x[01, 01, 09, 01, 07, 05, 09, 03, 0d, 1d, 11, 16, 1d, 03, 0d, 1f, 0d, 11, 23, 15, 19, 0b, 01, 0c, 01, 02, 17, 03, 07, 09, 00, 0e, 16, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 0e, 01, 0d, 00, 2a, 15, 00, 2a, 00, 2b, 12, 04, 0d, 00, 2a, 19, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 1b, 01, 01, 00, 02]
+Raw bytes (77): 0x[01, 01, 09, 01, 07, 05, 09, 03, 0d, 1d, 11, 16, 1d, 03, 0d, 1f, 0d, 23, 19, 11, 15, 0b, 01, 0c, 01, 02, 17, 03, 07, 09, 00, 0e, 16, 02, 09, 04, 1a, 1d, 06, 0d, 00, 29, 11, 00, 29, 00, 2a, 0e, 01, 0d, 00, 2a, 15, 00, 2a, 00, 2b, 12, 04, 0d, 00, 2a, 19, 00, 2a, 00, 2b, 0d, 03, 05, 00, 0b, 1b, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 9
@@ -70,8 +70,8 @@ Number of expressions: 9
- expression 4 operands: lhs = Expression(5, Sub), rhs = Counter(7)
- expression 5 operands: lhs = Expression(0, Add), rhs = Counter(3)
- expression 6 operands: lhs = Expression(7, Add), rhs = Counter(3)
-- expression 7 operands: lhs = Counter(4), rhs = Expression(8, Add)
-- expression 8 operands: lhs = Counter(5), rhs = Counter(6)
+- expression 7 operands: lhs = Expression(8, Add), rhs = Counter(6)
+- expression 8 operands: lhs = Counter(4), rhs = Counter(5)
Number of file 0 mappings: 11
- Code(Counter(0)) at (prev + 12, 1) to (start + 2, 23)
- Code(Expression(0, Add)) at (prev + 7, 9) to (start + 0, 14)
@@ -88,10 +88,10 @@ Number of file 0 mappings: 11
- Code(Counter(6)) at (prev + 0, 42) to (start + 0, 43)
- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
- Code(Expression(6, Add)) at (prev + 1, 1) to (start + 0, 2)
- = ((c4 + (c5 + c6)) + c3)
+ = (((c4 + c5) + c6) + c3)
Function name: try_error_result::test2
-Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, 11, c7, 01, cb, 01, db, 01, 15, cf, 01, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
+Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, c7, 01, db, 01, cb, 01, cf, 01, 11, 15, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3c, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 59
@@ -143,9 +143,9 @@ Number of expressions: 59
- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(15)
- expression 46 operands: lhs = Counter(19), rhs = Counter(14)
- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
-- expression 48 operands: lhs = Counter(4), rhs = Expression(49, Add)
-- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(54, Add)
-- expression 50 operands: lhs = Counter(5), rhs = Expression(51, Add)
+- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(54, Add)
+- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(51, Add)
+- expression 50 operands: lhs = Counter(4), rhs = Counter(5)
- expression 51 operands: lhs = Expression(52, Add), rhs = Expression(53, Add)
- expression 52 operands: lhs = Counter(6), rhs = Counter(7)
- expression 53 operands: lhs = Counter(8), rhs = Counter(9)
@@ -216,5 +216,5 @@ Number of file 0 mappings: 40
= ((c19 - c14) - c15)
- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
- Code(Expression(47, Add)) at (prev + 1, 1) to (start + 0, 2)
- = ((c4 + ((c5 + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15))))) + c3)
+ = ((((c4 + c5) + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15)))) + c3)
diff --git a/tests/coverage/unreachable.cov-map b/tests/coverage/unreachable.cov-map
index 495419820..55d124a16 100644
--- a/tests/coverage/unreachable.cov-map
+++ b/tests/coverage/unreachable.cov-map
@@ -1,24 +1,24 @@
Function name: unreachable::UNREACHABLE_CLOSURE::{closure#0}
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 27, 00, 49]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 0f, 27, 00, 47]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 15, 39) to (start + 0, 73)
+- Code(Counter(0)) at (prev + 15, 39) to (start + 0, 71)
Function name: unreachable::unreachable_function
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 01, 25]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 17, 1) to (start + 2, 2)
+- Code(Counter(0)) at (prev + 17, 1) to (start + 1, 37)
Function name: unreachable::unreachable_intrinsic
-Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 02, 02]
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 16, 01, 01, 2c]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
-- Code(Counter(0)) at (prev + 22, 1) to (start + 2, 2)
+- Code(Counter(0)) at (prev + 22, 1) to (start + 1, 44)
diff --git a/tests/coverage/unreachable.coverage b/tests/coverage/unreachable.coverage
index fa0ac9ccf..7015bb90a 100644
--- a/tests/coverage/unreachable.coverage
+++ b/tests/coverage/unreachable.coverage
@@ -16,12 +16,12 @@
LL| |
LL| 0|fn unreachable_function() {
LL| 0| unsafe { unreachable_unchecked() }
- LL| 0|}
+ LL| |}
LL| |
LL| |// Use an intrinsic to more reliably trigger unreachable-propagation.
LL| 0|fn unreachable_intrinsic() {
LL| 0| unsafe { std::intrinsics::unreachable() }
- LL| 0|}
+ LL| |}
LL| |
LL| |#[coverage(off)]
LL| |fn main() {