about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-08-14 13:23:26 +0200
committerRalf Jung <post@ralfj.de>2020-08-14 13:23:26 +0200
commitd0d9048d6ced47e95d90c0213dc3b35f979bbb40 (patch)
tree8ebcbf5cf1d12c895f4b8ffdaeef5bbb1aeea665
parent7805c200d982f11ab6dc3ead72bca89e9be4d294 (diff)
downloadrust-d0d9048d6ced47e95d90c0213dc3b35f979bbb40.tar.gz
rust-d0d9048d6ced47e95d90c0213dc3b35f979bbb40.zip
add a FIXME concerning interning of promoteds
-rw-r--r--src/librustc_mir/const_eval/eval_queries.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs
index 7fbe5c409d3..4101f70b820 100644
--- a/src/librustc_mir/const_eval/eval_queries.rs
+++ b/src/librustc_mir/const_eval/eval_queries.rs
@@ -57,6 +57,12 @@ fn eval_body_using_ecx<'mir, 'tcx>(
     ecx.run()?;
 
     // Intern the result
+    // FIXME: since the DefId of a promoted is the DefId of its owner, this
+    // means that promoteds in statics are actually interned like statics!
+    // However, this is also currently crucial because we promote mutable
+    // non-empty slices in statics to extend their lifetime, and this
+    // ensures that they are put into a mutable allocation.
+    // For other kinds of promoteds in statics (like array initializers), this is rather silly.
     let intern_kind = match tcx.static_mutability(cid.instance.def_id()) {
         Some(m) => InternKind::Static(m),
         None if cid.promoted.is_some() => InternKind::Promoted,