about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-11-30 17:01:28 +0100
committerRalf Jung <post@ralfj.de>2023-11-30 17:01:28 +0100
commita1b03e30675fcf1fadd9979f6c10a10182c7660e (patch)
tree3cdc510c553b6b95868f5b8f23bdf45990f518ee /compiler/rustc_const_eval/src/interpret
parentdf0295f07175acc7325ce3ca4152eb05752af1f2 (diff)
downloadrust-a1b03e30675fcf1fadd9979f6c10a10182c7660e.tar.gz
rust-a1b03e30675fcf1fadd9979f6c10a10182c7660e.zip
explain a good reason for why LocalValue does not store the type of the local
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 3bdfc1db913..32220b2aa76 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -173,6 +173,9 @@ impl<Prov: Provenance> std::fmt::Debug for LocalState<'_, Prov> {
 }
 
 /// Current value of a local variable
+///
+/// This does not store the type of the local; the type is given by `body.local_decls` and can never
+/// change, so by not storing here we avoid having to maintain that as an invariant.
 #[derive(Copy, Clone, Debug)] // Miri debug-prints these
 pub(super) enum LocalValue<Prov: Provenance = AllocId> {
     /// This local is not currently alive, and cannot be used at all.