Skip to content

Commit 785302d

Browse files
committed
Update comment and make it truer by actually doing what it says
1 parent 78c36b9 commit 785302d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustc/mir/interpret/value.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ pub struct RawConst<'tcx> {
1313
pub ty: Ty<'tcx>,
1414
/// the allocation that would be returned by using
1515
/// `tcx.alloc_map.lock().unwrap_memory(self.alloc_id)`
16+
///
17+
/// This is an optimization so we don't actually have to go fetch said allocation from the
18+
/// `alloc_map` at most use sites of the `const_eval_raw` query
1619
pub alloc: &'tcx Allocation,
1720
}
1821

src/librustc_mir/interpret/memory.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
348348
ErrorHandled::TooGeneric => EvalErrorKind::TooGeneric.into(),
349349
}
350350
}).map(|raw_const| {
351-
let allocation = tcx.alloc_map.lock().unwrap_memory(raw_const.alloc_id);
352351
// We got tcx memory. Let the machine figure out whether and how to
353352
// turn that into memory with the right pointer tag.
354-
M::adjust_static_allocation(allocation, memory_extra)
353+
M::adjust_static_allocation(raw_const.alloc, memory_extra)
355354
})
356355
}
357356

0 commit comments

Comments
 (0)