about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/errors.rs
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-06-21 21:02:27 -0700
committerGitHub <noreply@github.com>2024-06-21 21:02:27 -0700
commit9498d5cf2f550697888ec38c04e8ea028603f2e9 (patch)
treec2c6cc735a85a7c5d4be45e93bb1d149b2a4beaf /compiler/rustc_pattern_analysis/src/errors.rs
parent1f9793f1aad9e22511101d5c4d6c55c0a31c67b9 (diff)
parentb512bf6f77f9544b94d21755aeba164f82ae7094 (diff)
downloadrust-9498d5cf2f550697888ec38c04e8ea028603f2e9.tar.gz
rust-9498d5cf2f550697888ec38c04e8ea028603f2e9.zip
Rollup merge of #126787 - Strophox:get-bytes, r=RalfJung
Add direct accessors for memory addresses in `Machine` (for Miri)

The purpose of this PR is to enable direct (immutable) access to memory addresses in `Machine`, which will be needed for further extension of Miri.

This is done by adding (/completing missings pairs of) accessor functions, with the relevant signatures as follows:
```rust
/* rust/compiler/rustc_middle/src/mir/interpret/allocation.rs */

pub trait AllocBytes {
  // ..

  fn as_ptr(&self) -> *const u8;
/*fn as_mut_ptr(&mut self) -> *mut u8; -- Already in the compiler*/
}

impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes> {
  // ..

  pub fn get_bytes_unchecked_raw(&self) -> *const u8;
/*pub fn get_bytes_unchecked_raw_mut(&mut self) -> *mut u8; -- Already in the compiler*/
}
```
```rust
/* rust/compiler/rustc_const_eval/src/interpret/memory.rs */

impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
  // ..

  pub fn get_alloc_bytes_unchecked_raw(&self, id: AllocId) -> InterpResult<'tcx, *const u8>;
  pub fn get_alloc_bytes_unchecked_raw_mut(&mut self, id: AllocId) -> InterpResult<'tcx, *mut u8>;
}
```

r? ``@RalfJung``
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
0 files changed, 0 insertions, 0 deletions