Rollup merge of #141682 - nia-e:fixup-alloc, r=RalfJung

interpret/allocation: Fixup type for `alloc_bytes`

This can be `FnOnce`, which helps us avoid an extra clone in rust-lang/miri#4343

r? RalfJung
This commit is contained in:
Jacob Pratt 2025-05-29 04:49:45 +02:00 committed by GitHub
commit e987a99ed2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -512,7 +512,7 @@ impl Allocation {
pub fn adjust_from_tcx<'tcx, Prov: Provenance, Bytes: AllocBytes>(
&self,
cx: &impl HasDataLayout,
mut alloc_bytes: impl FnMut(&[u8], Align) -> InterpResult<'tcx, Bytes>,
alloc_bytes: impl FnOnce(&[u8], Align) -> InterpResult<'tcx, Bytes>,
mut adjust_ptr: impl FnMut(Pointer<CtfeProvenance>) -> InterpResult<'tcx, Pointer<Prov>>,
) -> InterpResult<'tcx, Allocation<Prov, (), Bytes>> {
// Copy the data.