diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-03-19 15:03:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-19 15:03:22 +0100 |
| commit | db4a97c4cbcb160b3754c803284dd0110d1de1e4 (patch) | |
| tree | d974b9eab71f38c10712c0a481544361e16e3e91 /compiler/rustc_codegen_llvm/src | |
| parent | 61372e1af6a100aedc203d0739073b42f8977e4e (diff) | |
| parent | 9dfda62763a4462407bf76b916b1808aed57401a (diff) | |
| download | rust-db4a97c4cbcb160b3754c803284dd0110d1de1e4.tar.gz rust-db4a97c4cbcb160b3754c803284dd0110d1de1e4.zip | |
Rollup merge of #82892 - jix:clarify-read-read, r=joshtriplett
Clarify docs for Read::read's return value Right now the docs for `Read::read`'s return value are phrased in a way that makes it easy for the reader to assume that the return value is never larger than the passed buffer. This PR clarifies that this is a requirement for implementations of the trait, but that callers have to expect a buggy yet safe implementation failing to do so, especially if unchecked accesses to the buffer are done afterwards. I fell into this trap recently, and when I noticed, I looked at the docs again and had the feeling that I might not have been the first one to miss this. The same issue of trusting the return value of `read` was also present in std itself for about 2.5 years and only fixed recently, see #80895. I hope that clarifying the docs might help others to avoid this issue.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
