@@ -165,6 +165,16 @@ where
165
165
166
166
/// True if the memo's value and `changed_at` time is still valid in this revision.
167
167
/// Does only a shallow O(1) check, doesn't walk the dependencies.
168
+ ///
169
+ /// In general, a provisional memo (from cycle iteration) does not verify. Since we don't
170
+ /// eagerly finalize all provisional memos in cycle iteration, we have to lazily check here
171
+ /// (via `validate_provisional`) whether a may-be-provisional memo should actually be verified
172
+ /// final, because its cycle heads are all now final.
173
+ ///
174
+ /// If `allow_provisional` is `true`, don't check provisionality and return whatever memo we
175
+ /// find that can be verified in this revision, whether provisional or not. This only occurs at
176
+ /// one call-site, in `fetch_cold` when we actually encounter a cycle, and want to check if
177
+ /// there is an existing provisional memo we can reuse.
168
178
#[ inline]
169
179
pub ( super ) fn shallow_verify_memo (
170
180
& self ,
@@ -213,6 +223,13 @@ where
213
223
214
224
/// Check if this memo's cycle heads have all been finalized. If so, mark it verified final and
215
225
/// return true, if not return false.
226
+ ///
227
+ /// This check is not recursive, so it is not guaranteed that we will validate a provisional
228
+ /// memo that transitively should be validated. That is, if provisional memo A has cycle head
229
+ /// B, which also has a provisional memo with cycle head C, and C is verified final, we will
230
+ /// not validate A if we call `validate_provisional` on it, unless we first call
231
+ /// `validate_provisional` on B. Thus, `deep_verify_memo` needs to call `validate_provisional`
232
+ /// on maybe-provisional memos _after_ visiting all dependencies.
216
233
fn validate_provisional (
217
234
& self ,
218
235
db : & C :: DbView ,
0 commit comments