Rollup merge of #48165 - alexcrichton:update-read2, r=Mark-Simulacrum
Rollup merge of #48165 - alexcrichton:update-read2, r=Mark-Simulacrum

Update compiletest's `read2` function

This was originally copied over from Cargo and Cargo has since [been
updated][update] so let's pull in the fixes here too!

[update]: https://github.com/rust-lang/cargo/pull/5030

graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,GBGamer/rust