Skip to content

Commit d0d9048

Browse files
committed
add a FIXME concerning interning of promoteds
1 parent 7805c20 commit d0d9048

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_mir/const_eval/eval_queries.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ fn eval_body_using_ecx<'mir, 'tcx>(
5757
ecx.run()?;
5858

5959
// Intern the result
60+
// FIXME: since the DefId of a promoted is the DefId of its owner, this
61+
// means that promoteds in statics are actually interned like statics!
62+
// However, this is also currently crucial because we promote mutable
63+
// non-empty slices in statics to extend their lifetime, and this
64+
// ensures that they are put into a mutable allocation.
65+
// For other kinds of promoteds in statics (like array initializers), this is rather silly.
6066
let intern_kind = match tcx.static_mutability(cid.instance.def_id()) {
6167
Some(m) => InternKind::Static(m),
6268
None if cid.promoted.is_some() => InternKind::Promoted,

0 commit comments

Comments
 (0)