@@ -208,11 +208,17 @@ impl<O: ForestObligation> ObligationForest<O> {
208
208
///
209
209
/// This CAN be done in a snapshot
210
210
pub fn register_obligation ( & mut self , obligation : O ) {
211
- self . register_obligation_at ( obligation, None )
211
+ // Ignore errors here - there is no guarantee of success.
212
+ let _ = self . register_obligation_at ( obligation, None ) ;
212
213
}
213
214
214
- fn register_obligation_at ( & mut self , obligation : O , parent : Option < NodeIndex > ) {
215
- if self . done_cache . contains ( obligation. as_predicate ( ) ) { return }
215
+ // returns Err(()) if we already know this obligation failed.
216
+ fn register_obligation_at ( & mut self , obligation : O , parent : Option < NodeIndex > )
217
+ -> Result < ( ) , ( ) >
218
+ {
219
+ if self . done_cache . contains ( obligation. as_predicate ( ) ) {
220
+ return Ok ( ( ) )
221
+ }
216
222
217
223
match self . waiting_cache . entry ( obligation. as_predicate ( ) . clone ( ) ) {
218
224
Entry :: Occupied ( o) => {
@@ -226,15 +232,21 @@ impl<O: ForestObligation> ObligationForest<O> {
226
232
self . nodes [ o. get ( ) . get ( ) ] . dependents . push ( parent) ;
227
233
}
228
234
}
235
+ if let NodeState :: Error = self . nodes [ o. get ( ) . get ( ) ] . state . get ( ) {
236
+ Err ( ( ) )
237
+ } else {
238
+ Ok ( ( ) )
239
+ }
229
240
}
230
241
Entry :: Vacant ( v) => {
231
242
debug ! ( "register_obligation_at({:?}, {:?}) - ok" ,
232
243
obligation, parent) ;
233
244
v. insert ( NodeIndex :: new ( self . nodes . len ( ) ) ) ;
234
245
self . cache_list . push ( obligation. as_predicate ( ) . clone ( ) ) ;
235
246
self . nodes . push ( Node :: new ( parent, obligation) ) ;
247
+ Ok ( ( ) )
236
248
}
237
- } ;
249
+ }
238
250
}
239
251
240
252
/// Convert all remaining obligations to the given error.
@@ -306,12 +318,19 @@ impl<O: ForestObligation> ObligationForest<O> {
306
318
Ok ( Some ( children) ) => {
307
319
// if we saw a Some(_) result, we are not (yet) stalled
308
320
stalled = false ;
321
+ self . nodes [ index] . state . set ( NodeState :: Success ) ;
322
+
309
323
for child in children {
310
- self . register_obligation_at ( child,
311
- Some ( NodeIndex :: new ( index) ) ) ;
324
+ let st = self . register_obligation_at (
325
+ child,
326
+ Some ( NodeIndex :: new ( index) )
327
+ ) ;
328
+ if let Err ( ( ) ) = st {
329
+ // error already reported - propagate it
330
+ // to our node.
331
+ self . error_at ( index) ;
332
+ }
312
333
}
313
-
314
- self . nodes [ index] . state . set ( NodeState :: Success ) ;
315
334
}
316
335
Err ( err) => {
317
336
let backtrace = self . error_at ( index) ;
0 commit comments