Skip to content

Commit 47e2cc2

Browse files
committed
generalize adjust_from_tcx
1 parent 79734f1 commit 47e2cc2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_middle/src/mir/interpret/allocation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,10 @@ impl<Prov: Provenance, Bytes: AllocBytes> Allocation<Prov, (), Bytes> {
346346
}
347347
}
348348

349-
impl<Bytes: AllocBytes> Allocation<CtfeProvenance, (), Bytes> {
349+
impl Allocation {
350350
/// Adjust allocation from the ones in `tcx` to a custom Machine instance
351-
/// with a different `Provenance` and `Extra` type.
352-
pub fn adjust_from_tcx<Prov: Provenance, Extra, Err>(
351+
/// with a different `Provenance`, `Extra` and `Byte` type.
352+
pub fn adjust_from_tcx<Prov: Provenance, Extra, Bytes: AllocBytes, Err>(
353353
self,
354354
cx: &impl HasDataLayout,
355355
extra: Extra,
@@ -371,7 +371,7 @@ impl<Bytes: AllocBytes> Allocation<CtfeProvenance, (), Bytes> {
371371
}
372372
// Create allocation.
373373
Ok(Allocation {
374-
bytes,
374+
bytes: AllocBytes::from_bytes(Cow::from(&*bytes), self.align),
375375
provenance: ProvenanceMap::from_presorted_ptrs(new_provenance),
376376
init_mask: self.init_mask,
377377
align: self.align,

0 commit comments

Comments
 (0)