Manually run `x fmt` on all source files in `tests/coverage/`

Currently we can't automatically enforce formatting on tests (see #125637), but
we can at least keep things relatively tidy by occasionally running the
formatter manually.

This was done by temporarily commenting out the `"/tests/"` exclusion in
`rustfmt.toml`, and then running `x fmt tests/coverage` and
`x test coverage --bless`.
This commit is contained in:
Zalathar 2024-05-29 14:27:57 +10:00
parent 448d63e946
commit 9dc6e08279
12 changed files with 34 additions and 44 deletions

View File

@ -12,7 +12,7 @@ Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
Function name: coroutine::main
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, 13, 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, 13, 01, 02, 16, 01, 08, 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
@ -26,7 +26,7 @@ Number of expressions: 8
- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
Number of file 0 mappings: 9
- Code(Counter(0)) at (prev + 19, 1) to (start + 2, 22)
- Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46)
- Code(Counter(0)) at (prev + 8, 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)
@ -41,11 +41,11 @@ Number of file 0 mappings: 9
= ((c4 - c5) - c6)
Function name: coroutine::main::{closure#0}
Raw bytes (14): 0x[01, 01, 00, 02, 01, 15, 29, 01, 1f, 05, 02, 10, 01, 06]
Raw bytes (14): 0x[01, 01, 00, 02, 01, 16, 08, 01, 1f, 05, 02, 10, 01, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 21, 41) to (start + 1, 31)
- Code(Counter(0)) at (prev + 22, 8) to (start + 1, 31)
- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)

View File

@ -18,7 +18,8 @@
LL| |
LL| 1|fn main() {
LL| 1| let is_true = std::env::args().len() == 1;
LL| 1| let mut coroutine = #[coroutine] || {
LL| 1| let mut coroutine = #[coroutine]
LL| 1| || {
LL| 1| yield get_u32(is_true);
LL| 1| return "foo";
LL| 1| };

View File

@ -18,7 +18,8 @@ fn get_u32(val: bool) -> Result<u32, String> {
fn main() {
let is_true = std::env::args().len() == 1;
let mut coroutine = #[coroutine] || {
let mut coroutine = #[coroutine]
|| {
yield get_u32(is_true);
return "foo";
};

View File

@ -1,12 +1,12 @@
Function name: let_else_loop::_if (unused)
Raw bytes (19): 0x[01, 01, 00, 03, 00, 16, 01, 01, 0c, 00, 02, 09, 00, 10, 00, 02, 09, 00, 10]
Raw bytes (19): 0x[01, 01, 00, 03, 00, 16, 01, 01, 0c, 00, 01, 0f, 00, 16, 00, 00, 20, 00, 27]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 3
- Code(Zero) at (prev + 22, 1) to (start + 1, 12)
- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
- Code(Zero) at (prev + 2, 9) to (start + 0, 16)
- Code(Zero) at (prev + 1, 15) to (start + 0, 22)
- Code(Zero) at (prev + 0, 32) to (start + 0, 39)
Function name: let_else_loop::_loop_either_way (unused)
Raw bytes (19): 0x[01, 01, 00, 03, 00, 0f, 01, 01, 14, 00, 01, 1c, 00, 23, 00, 01, 05, 00, 0c]

View File

@ -21,11 +21,7 @@
LL| |// Variant using regular `if` instead of let-else.
LL| |// This doesn't trigger the original ICE, but might help detect regressions.
LL| 0|fn _if(cond: bool) {
LL| 0| if cond {
LL| 0| loop {}
LL| | } else {
LL| 0| loop {}
LL| | }
LL| 0| if cond { loop {} } else { loop {} }
LL| |}
LL| |
LL| |#[coverage(off)]

View File

@ -20,11 +20,7 @@ fn _loop_either_way(cond: bool) {
// Variant using regular `if` instead of let-else.
// This doesn't trigger the original ICE, but might help detect regressions.
fn _if(cond: bool) {
if cond {
loop {}
} else {
loop {}
}
if cond { loop {} } else { loop {} }
}
#[coverage(off)]

View File

@ -1,16 +1,16 @@
Function name: <partial_eq::Version>::new
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 05, 06, 06]
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 05, 02, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 12, 5) to (start + 6, 6)
- Code(Counter(0)) at (prev + 12, 5) to (start + 2, 6)
Function name: partial_eq::main
Raw bytes (9): 0x[01, 01, 00, 01, 01, 15, 01, 0a, 02]
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 01, 0a, 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 + 21, 1) to (start + 10, 2)
- Code(Counter(0)) at (prev + 17, 1) to (start + 10, 2)

View File

@ -10,11 +10,7 @@
LL| |
LL| |impl Version {
LL| 2| pub fn new(major: usize, minor: usize, patch: usize) -> Self {
LL| 2| Self {
LL| 2| major,
LL| 2| minor,
LL| 2| patch,
LL| 2| }
LL| 2| Self { major, minor, patch }
LL| 2| }
LL| |}
LL| |

View File

@ -10,11 +10,7 @@ pub struct Version {
impl Version {
pub fn new(major: usize, minor: usize, patch: usize) -> Self {
Self {
major,
minor,
patch,
}
Self { major, minor, patch }
}
}

View File

@ -1,5 +1,5 @@
Function name: yield::main
Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 06, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 07, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02]
Raw bytes (106): 0x[01, 01, 0b, 05, 00, 0d, 11, 22, 15, 0d, 11, 11, 15, 22, 15, 0d, 11, 22, 15, 0d, 11, 19, 1d, 25, 29, 10, 01, 07, 01, 01, 16, 01, 07, 0b, 00, 2e, 0d, 01, 27, 00, 29, 03, 01, 0e, 00, 34, 0d, 02, 0b, 00, 2e, 22, 01, 22, 00, 27, 1e, 00, 2c, 00, 2e, 13, 01, 0e, 00, 34, 1e, 03, 09, 00, 16, 1e, 08, 0b, 00, 2e, 21, 01, 27, 00, 29, 27, 01, 0e, 00, 34, 21, 02, 0b, 00, 2e, 2d, 01, 27, 00, 29, 2b, 01, 0e, 00, 34, 2d, 02, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 11
@ -16,7 +16,7 @@ Number of expressions: 11
- expression 10 operands: lhs = Counter(9), rhs = Counter(10)
Number of file 0 mappings: 16
- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 22)
- Code(Counter(0)) at (prev + 6, 11) to (start + 0, 46)
- Code(Counter(0)) at (prev + 7, 11) to (start + 0, 46)
- Code(Counter(3)) at (prev + 1, 39) to (start + 0, 41)
- Code(Expression(0, Add)) at (prev + 1, 14) to (start + 0, 52)
= (c1 + Zero)
@ -29,7 +29,7 @@ Number of file 0 mappings: 16
= (c4 + c5)
- Code(Expression(7, Sub)) at (prev + 3, 9) to (start + 0, 22)
= ((c3 - c4) - c5)
- Code(Expression(7, Sub)) at (prev + 7, 11) to (start + 0, 46)
- Code(Expression(7, Sub)) at (prev + 8, 11) to (start + 0, 46)
= ((c3 - c4) - c5)
- Code(Counter(8)) at (prev + 1, 39) to (start + 0, 41)
- Code(Expression(9, Add)) at (prev + 1, 14) to (start + 0, 52)
@ -41,21 +41,21 @@ Number of file 0 mappings: 16
- Code(Counter(11)) at (prev + 2, 1) to (start + 0, 2)
Function name: yield::main::{closure#0}
Raw bytes (14): 0x[01, 01, 00, 02, 01, 08, 29, 01, 10, 05, 02, 10, 01, 06]
Raw bytes (14): 0x[01, 01, 00, 02, 01, 09, 08, 01, 10, 05, 02, 10, 01, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 8, 41) to (start + 1, 16)
- Code(Counter(0)) at (prev + 9, 8) to (start + 1, 16)
- Code(Counter(1)) at (prev + 2, 16) to (start + 1, 6)
Function name: yield::main::{closure#1}
Raw bytes (24): 0x[01, 01, 00, 04, 01, 16, 29, 01, 10, 05, 02, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 01, 06]
Raw bytes (24): 0x[01, 01, 00, 04, 01, 18, 08, 01, 10, 05, 02, 09, 00, 10, 09, 01, 09, 00, 10, 0d, 01, 10, 01, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 0
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 22, 41) to (start + 1, 16)
- Code(Counter(0)) at (prev + 24, 8) to (start + 1, 16)
- Code(Counter(1)) at (prev + 2, 9) to (start + 0, 16)
- Code(Counter(2)) at (prev + 1, 9) to (start + 0, 16)
- Code(Counter(3)) at (prev + 1, 16) to (start + 1, 6)

View File

@ -5,7 +5,8 @@
LL| |use std::pin::Pin;
LL| |
LL| 1|fn main() {
LL| 1| let mut coroutine = #[coroutine] || {
LL| 1| let mut coroutine = #[coroutine]
LL| 1| || {
LL| 1| yield 1;
LL| 1| return "foo";
LL| 1| };
@ -19,7 +20,8 @@
LL| 0| _ => panic!("unexpected value from resume"),
LL| | }
LL| |
LL| 1| let mut coroutine = #[coroutine] || {
LL| 1| let mut coroutine = #[coroutine]
LL| 1| || {
LL| 1| yield 1;
LL| 1| yield 2;
LL| 0| yield 3;

View File

@ -5,7 +5,8 @@ use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
fn main() {
let mut coroutine = #[coroutine] || {
let mut coroutine = #[coroutine]
|| {
yield 1;
return "foo";
};
@ -19,7 +20,8 @@ fn main() {
_ => panic!("unexpected value from resume"),
}
let mut coroutine = #[coroutine] || {
let mut coroutine = #[coroutine]
|| {
yield 1;
yield 2;
yield 3;