permits things to become *more* durable without a "change"

This will be important if we want to automatically upgrade the
durability of inputs.
This commit is contained in:
Niko Matsakis 2019-06-23 05:24:58 -07:00
parent 7bf4f9dc4f
commit 86dfdd1fda

View file

@ -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!(