diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-10-07 22:05:31 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-07 22:05:31 +0530 |
| commit | fe4200365e4478365ace6e819caacd586ab113be (patch) | |
| tree | a97dde214c606788d4e98f4767100cb039b8dec6 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp | |
| parent | e461e94165e56be0b40d3916a0eb24745ea6e75c (diff) | |
| parent | 95ae993bd86b97aff9a27498f2187fef431cab58 (diff) | |
| download | rust-fe4200365e4478365ace6e819caacd586ab113be.tar.gz rust-fe4200365e4478365ace6e819caacd586ab113be.zip | |
Rollup merge of #102760 - saethlin:dont-reinit-buffer, r=Mark-Simulacrum
Avoid repeated re-initialization of the BufReader buffer Fixes https://github.com/rust-lang/rust/issues/102727 We accidentally removed this in https://github.com/rust-lang/rust/pull/98748. It looks so redundant. But it isn't. The default `Read::read_buf` will defensively initialize the whole buffer, if any of it is indicated to be uninitialized. In uses where reads from the wrapped `Read` impl completely fill the `BufReader`, `initialized` and `filled` are the same, and this extra member isn't required. But in the reported issue, the `BufReader` wraps a `Read` impl which will _never_ fill the whole buffer. So the default `Read::read_buf` implementation repeatedly re-initializes the extra space in the buffer. This adds back the extra `initialized` member, which ensures that the default `Read::read_buf` only zero-initialized the buffer once, and I've tried to add a comment which explains this whole situation.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
