diff options
| author | Ralf Jung <post@ralfj.de> | 2022-07-26 21:49:34 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-08-26 13:20:56 -0400 |
| commit | 2e52fe01cfe8c26cbd414c4ff24d53f6e5cea29d (patch) | |
| tree | 5ff5db8fbea93741ed028c502c53b315a24ed10a /compiler/rustc_middle/src/mir | |
| parent | da13935ecc5b07e3e6deebc68bde049440430461 (diff) | |
| download | rust-2e52fe01cfe8c26cbd414c4ff24d53f6e5cea29d.tar.gz rust-2e52fe01cfe8c26cbd414c4ff24d53f6e5cea29d.zip | |
remove some now-unnecessary parameters from check_bytes
Diffstat (limited to 'compiler/rustc_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation.rs | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index db7e0fb8a3b..12a3604f4bb 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -415,25 +415,10 @@ impl<Prov: Provenance, Extra> Allocation<Prov, Extra> { /// Reading and writing. impl<Prov: Provenance, Extra> Allocation<Prov, Extra> { - /// Validates that `ptr.offset` and `ptr.offset + size` do not point to the middle of a - /// relocation. If `allow_uninit`/`allow_ptr` is `false`, also enforces that the memory in the - /// given range contains no uninitialized bytes/relocations. - pub fn check_bytes( - &self, - cx: &impl HasDataLayout, - range: AllocRange, - allow_uninit: bool, - allow_ptr: bool, - ) -> AllocResult { - // Check bounds and relocations on the edges. - self.get_bytes_with_uninit_and_ptr(cx, range)?; - // Check uninit and ptr. - if !allow_uninit { - self.check_init(range)?; - } - if !allow_ptr { - self.check_relocations(cx, range)?; - } + /// Validates that this memory range is initiailized and contains no relocations. + pub fn check_bytes(&self, cx: &impl HasDataLayout, range: AllocRange) -> AllocResult { + // This implicitly does all the checking we are asking for. + self.get_bytes(cx, range)?; Ok(()) } |
