diff options
| author | bors <bors@rust-lang.org> | 2023-03-03 16:02:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-03 16:02:37 +0000 |
| commit | 7a809ce8997a1697b166b4bb2594993e87d69f31 (patch) | |
| tree | 5510959c6bc814d01b5f71f70a733a3f48351a8d /compiler/rustc_const_eval/src/interpret/machine.rs | |
| parent | 13471d3b2046cce78181dde6cfc146c09f55e29e (diff) | |
| parent | e85df8d0fe169f8c9b25f2dfe775b62e22ccd20f (diff) | |
| download | rust-7a809ce8997a1697b166b4bb2594993e87d69f31.tar.gz rust-7a809ce8997a1697b166b4bb2594993e87d69f31.zip | |
Auto merge of #108677 - matthiaskrgr:rollup-i91cxuf, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #108022 (Support allocations with non-Box<[u8]> bytes) - #108367 (Re-apply "switch to the macos-12-xl builder") - #108557 (Point error span at Some constructor argument when trait resolution fails) - #108573 (Explain compile-time vs run-time difference in env!() error message) - #108584 (Put backtick content from rustdoc search errors into a `<code>` elements) - #108624 (Make `ExprKind` the first field in `thir::Expr`) - #108644 (Allow setting hashmap toml values in `./configure`) - #108672 (Feed queries on impl side for RPITITs when using lower_impl_trait_in_trait_to_assoc_ty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/machine.rs')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/machine.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs index 450488315ef..92fa59aec6e 100644 --- a/compiler/rustc_const_eval/src/interpret/machine.rs +++ b/compiler/rustc_const_eval/src/interpret/machine.rs @@ -16,8 +16,8 @@ use rustc_target::spec::abi::Abi as CallAbi; use crate::const_eval::CheckAlignment; use super::{ - AllocId, AllocRange, Allocation, ConstAllocation, Frame, ImmTy, InterpCx, InterpResult, - MemoryKind, OpTy, Operand, PlaceTy, Pointer, Provenance, Scalar, StackPopUnwind, + AllocBytes, AllocId, AllocRange, Allocation, ConstAllocation, Frame, ImmTy, InterpCx, + InterpResult, MemoryKind, OpTy, Operand, PlaceTy, Pointer, Provenance, Scalar, StackPopUnwind, }; /// Data returned by Machine::stack_pop, @@ -105,10 +105,16 @@ pub trait Machine<'mir, 'tcx>: Sized { /// Extra data stored in every allocation. type AllocExtra: Debug + Clone + 'static; + /// Type for the bytes of the allocation. + type Bytes: AllocBytes + 'static; + /// Memory's allocation map type MemoryMap: AllocMap< AllocId, - (MemoryKind<Self::MemoryKind>, Allocation<Self::Provenance, Self::AllocExtra>), + ( + MemoryKind<Self::MemoryKind>, + Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>, + ), > + Default + Clone; @@ -338,7 +344,7 @@ pub trait Machine<'mir, 'tcx>: Sized { id: AllocId, alloc: Cow<'b, Allocation>, kind: Option<MemoryKind<Self::MemoryKind>>, - ) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra>>>; + ) -> InterpResult<'tcx, Cow<'b, Allocation<Self::Provenance, Self::AllocExtra, Self::Bytes>>>; fn eval_inline_asm( _ecx: &mut InterpCx<'mir, 'tcx, Self>, @@ -459,6 +465,7 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) { type AllocExtra = (); type FrameExtra = (); + type Bytes = Box<[u8]>; #[inline(always)] fn use_addr_for_alignment_check(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool { |
