From 86dfdd1fdadabba021af48c73403a8058d202386 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sun, 23 Jun 2019 05:24:58 -0700 Subject: [PATCH] permits things to become *more* durable without a "change" This will be important if we want to automatically upgrade the durability of inputs. --- src/derived/slot.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/derived/slot.rs b/src/derived/slot.rs index ac6be194..295c7017 100644 --- a/src/derived/slot.rs +++ b/src/derived/slot.rs @@ -219,9 +219,11 @@ where // old value. if let Some(old_memo) = &panic_guard.memo { if let Some(old_value) = &old_memo.value { - // Careful: the "constant-ness" must also not have - // changed, see the test `constant_to_non_constant`. - if old_memo.durability == result.durability + // Careful: if the value became less durable than it + // used to be, that is a "breaking change" that our + // consumers must be aware of. Becoming *more* durable + // is not. See the test `constant_to_non_constant`. + if result.durability >= old_memo.durability && MP::memoized_value_eq(&old_value, &result.value) { debug!(