Problem
The following image is two screenshots, side by side, of the output of "cargo test" from two test runs seconds apart with the same code. As you can see, there seems to be a race (or race-like behavior) causing text written to the stdout buffer to be interleaved together.
This is exclusive to when --nocapture is specified. I cannot reproduce if --nocapture is not specified.

Usually it works "correctly" but I can I can do this over and over and continue getting different versions of incorrectly printed output each time.

Another one

Notes
Output of cargo version:
cargo 1.53.0-nightly (0ed318d18 2021-04-23)
rustc 1.53.0-nightly (42816d6 2021-04-24)
Problem
The following image is two screenshots, side by side, of the output of "cargo test" from two test runs seconds apart with the same code. As you can see, there seems to be a race (or race-like behavior) causing text written to the stdout buffer to be interleaved together.
This is exclusive to when
--nocaptureis specified. I cannot reproduce if--nocaptureis not specified.Usually it works "correctly" but I can I can do this over and over and continue getting different versions of incorrectly printed output each time.
Another one
Notes
Output of
cargo version:cargo 1.53.0-nightly (0ed318d18 2021-04-23)
rustc 1.53.0-nightly (42816d6 2021-04-24)