about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-22 20:04:52 +0000
committerbors <bors@rust-lang.org>2021-05-22 20:04:52 +0000
commite4ca1662f255db774dcd16ed9c3776bf25ac8361 (patch)
treec07eaf990dd5645786caadd0b0daa9377e776908 /compiler
parentf98bd7eeca7f01be426b8ffe73ae6717a9659a82 (diff)
parent96ae3008891bc37976c4d33f2d1695bcb6af461c (diff)
downloadrust-e4ca1662f255db774dcd16ed9c3776bf25ac8361.tar.gz
rust-e4ca1662f255db774dcd16ed9c3776bf25ac8361.zip
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`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir/src/interpret/memory.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_mir/src/interpret/memory.rs b/compiler/rustc_mir/src/interpret/memory.rs
index 7fb7c51b0b5..d45ea352028 100644
--- a/compiler/rustc_mir/src/interpret/memory.rs
+++ b/compiler/rustc_mir/src/interpret/memory.rs
@@ -673,8 +673,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
     pub fn get_alloc_extra_mut<'a>(
         &'a mut self,
         id: AllocId,
-    ) -> InterpResult<'tcx, &'a mut M::AllocExtra> {
-        Ok(&mut self.get_raw_mut(id)?.0.extra)
+    ) -> InterpResult<'tcx, (&'a mut M::AllocExtra, &'a mut M::MemoryExtra)> {
+        let (alloc, memory_extra) = self.get_raw_mut(id)?;
+        Ok((&mut alloc.extra, memory_extra))
     }
 
     /// Obtain the size and alignment of an allocation, even if that allocation has