about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStrophox <strophox@gmail.com>2024-04-22 03:57:01 +0200
committerStrophox <strophox@gmail.com>2024-05-03 13:47:16 +0200
commit47e2cc2ea1dd842b8d67fde17c6d37622ec67a40 (patch)
tree992ae3e881e48d370420c929262967bace3d674d
parent79734f1db8dbe322192dea32c0f6b80ab14c4c1d (diff)
downloadrust-47e2cc2ea1dd842b8d67fde17c6d37622ec67a40.tar.gz
rust-47e2cc2ea1dd842b8d67fde17c6d37622ec67a40.zip
generalize adjust_from_tcx
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index 9cc5c6a2ee9..0828e2858f7 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -346,10 +346,10 @@ impl<Prov: Provenance, Bytes: AllocBytes> Allocation<Prov, (), Bytes> {
     }
 }
 
-impl<Bytes: AllocBytes> Allocation<CtfeProvenance, (), Bytes> {
+impl Allocation {
     /// Adjust allocation from the ones in `tcx` to a custom Machine instance
-    /// with a different `Provenance` and `Extra` type.
-    pub fn adjust_from_tcx<Prov: Provenance, Extra, Err>(
+    /// with a different `Provenance`, `Extra` and `Byte` type.
+    pub fn adjust_from_tcx<Prov: Provenance, Extra, Bytes: AllocBytes, Err>(
         self,
         cx: &impl HasDataLayout,
         extra: Extra,
@@ -371,7 +371,7 @@ impl<Bytes: AllocBytes> Allocation<CtfeProvenance, (), Bytes> {
         }
         // Create allocation.
         Ok(Allocation {
-            bytes,
+            bytes: AllocBytes::from_bytes(Cow::from(&*bytes), self.align),
             provenance: ProvenanceMap::from_presorted_ptrs(new_provenance),
             init_mask: self.init_mask,
             align: self.align,