diff options
| author | bors <bors@rust-lang.org> | 2019-06-24 17:44:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-24 17:44:13 +0000 |
| commit | 7e08576e4276a97b523c25bfd196d419c39c7b87 (patch) | |
| tree | 9143b02b594cbc2f5d62201343c97375423c31ca /src/test/debuginfo/enum-thinlto.rs | |
| parent | bbbb3e597482bec1260ea733f7d3fc813bc136ae (diff) | |
| parent | 7e830286c7a0c19e57d1a09e9a0bde7933f68bb6 (diff) | |
| download | rust-7e08576e4276a97b523c25bfd196d419c39c7b87.tar.gz rust-7e08576e4276a97b523c25bfd196d419c39c7b87.zip | |
Auto merge of #62081 - RalfJung:miri-pointer-checks, r=oli-obk
Refactor miri pointer checks Centralize bounds, alignment and NULL checking for memory accesses in one function: `memory.check_ptr_access`. That function also takes care of converting a `Scalar` to a `Pointer`, should that be needed. Not all accesses need that though: if the access has size 0, `None` is returned. Everyone accessing memory based on a `Scalar` should use this method to get the `Pointer` they need. All operations on the `Allocation` work on `Pointer` inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on `Memory` work on `Scalar` inputs and do the checks themselves. The only other public method to check pointers is `memory.ptr_may_be_null`, which is needed in a few places. No need for `check_align` or similar methods. That makes the public API surface much easier to use and harder to mis-use. This should be largely no-functional-change, except that ZST accesses to a "true" pointer that is dangling or out-of-bounds are now considered UB. This is to be conservative wrt. whatever LLVM might be doing. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits). r? @oli-obk
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
