Skip to content

Commit 716b920

Browse files
committed
generalize adjust_from_tcx
1 parent 1b3fba0 commit 716b920

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
@@ -345,10 +345,10 @@ impl<Prov: Provenance, Bytes: AllocBytes> Allocation<Prov, (), Bytes> {
345345
}
346346
}
347347

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

0 commit comments

Comments
 (0)