Skip to content

Commit e4ca166

Browse files
committed
Auto merge of #85578 - RalfJung:alloc-mem-extra, r=oli-obk
CTFE get_alloc_extra_mut: also provide ref to MemoryExtra This would let me use mutable references in more places in Stacked Borrows, avoiding some `RefCell` overhead. :) r? `@oli-obk`
2 parents f98bd7e + 96ae300 commit e4ca166

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_mir/src/interpret/memory.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
673673
pub fn get_alloc_extra_mut<'a>(
674674
&'a mut self,
675675
id: AllocId,
676-
) -> InterpResult<'tcx, &'a mut M::AllocExtra> {
677-
Ok(&mut self.get_raw_mut(id)?.0.extra)
676+
) -> InterpResult<'tcx, (&'a mut M::AllocExtra, &'a mut M::MemoryExtra)> {
677+
let (alloc, memory_extra) = self.get_raw_mut(id)?;
678+
Ok((&mut alloc.extra, memory_extra))
678679
}
679680

680681
/// Obtain the size and alignment of an allocation, even if that allocation has

0 commit comments

Comments
 (0)