Skip to content

Commit 5d46b98

Browse files
committed
Document base vs nested alloc interning
1 parent a57a00e commit 5d46b98

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+3
-0
lines changed

compiler/rustc_const_eval/src/interpret/intern.rs

+3
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ pub fn intern_const_alloc_recursive<
125125

126126
// Intern the base allocation, and initialize todo list for recursive interning.
127127
let base_alloc_id = ret.ptr().provenance.unwrap().alloc_id();
128+
// First we intern the base allocation, as it requires a different mutability.
129+
// This gives us the initial set of nested allocations, which will then all be processed
130+
// recursively in the loop below.
128131
let mut todo: Vec<_> =
129132
intern_shallow(ecx, base_alloc_id, base_mutability).unwrap().map(|prov| prov).collect();
130133
// We need to distinguish "has just been interned" from "was already in `tcx`",

0 commit comments

Comments
 (0)