Skip to content

Commit a1b03e3

Browse files
committed
explain a good reason for why LocalValue does not store the type of the local
1 parent df0295f commit a1b03e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_const_eval/src/interpret/eval_context.rs

+3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ impl<Prov: Provenance> std::fmt::Debug for LocalState<'_, Prov> {
173173
}
174174

175175
/// Current value of a local variable
176+
///
177+
/// This does not store the type of the local; the type is given by `body.local_decls` and can never
178+
/// change, so by not storing here we avoid having to maintain that as an invariant.
176179
#[derive(Copy, Clone, Debug)] // Miri debug-prints these
177180
pub(super) enum LocalValue<Prov: Provenance = AllocId> {
178181
/// This local is not currently alive, and cannot be used at all.

0 commit comments

Comments
 (0)