Rollup merge of #142673 - oli-obk:uninit-read-mem, r=RalfJung
Show the offset, length and memory of uninit read errors r? ``@RalfJung`` I want to improve memory dumps in general. Not sure yet how to do so best within rust diagnostics, but in a perfect world I could generate a dummy in-memory file (that contains the rendered memory dump) that we then can then provide regular rustc `Span`s to. So we'd basically report normal diagnostics for them with squiggly lines and everything.
This commit is contained in:
@@ -702,8 +702,11 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
|
||||
read_provenance: bool,
|
||||
) -> AllocResult<Scalar<Prov>> {
|
||||
// First and foremost, if anything is uninit, bail.
|
||||
if self.init_mask.is_range_initialized(range).is_err() {
|
||||
return Err(AllocError::InvalidUninitBytes(None));
|
||||
if let Err(bad) = self.init_mask.is_range_initialized(range) {
|
||||
return Err(AllocError::InvalidUninitBytes(Some(BadBytesAccess {
|
||||
access: range,
|
||||
bad,
|
||||
})));
|
||||
}
|
||||
|
||||
// Get the integer part of the result. We HAVE TO check provenance before returning this!
|
||||
|
||||
Reference in New Issue
Block a user