@@ -322,6 +322,38 @@ impl<'tcx> Change<'tcx> {
322
322
self . changes . push ( ( type_, span) ) ;
323
323
}
324
324
325
+ /// Check whether a trait item contains breaking changes preventing further analysis of it's
326
+ /// child items.
327
+ fn trait_item_breaking ( & self ) -> bool {
328
+ for change in & self . changes {
329
+ match change. 0 {
330
+ ItemMadePrivate |
331
+ KindDifference |
332
+ RegionParameterRemoved |
333
+ TypeParameterRemoved { .. } |
334
+ VariantAdded |
335
+ VariantRemoved |
336
+ VariantFieldAdded { .. } |
337
+ VariantFieldRemoved { .. } |
338
+ VariantStyleChanged { .. } |
339
+ TypeChanged { .. } |
340
+ FnConstChanged { now_const : false } |
341
+ MethodSelfChanged { now_self : false } |
342
+ Unknown => return true ,
343
+ RegionParameterAdded |
344
+ MethodSelfChanged { now_self : true } |
345
+ TraitItemAdded { .. } |
346
+ TraitItemRemoved { .. } |
347
+ ItemMadePublic |
348
+ TypeParameterAdded { .. } |
349
+ TraitUnsafetyChanged { .. } |
350
+ FnConstChanged { now_const : true } => ( ) ,
351
+ }
352
+ }
353
+
354
+ false
355
+ }
356
+
325
357
/// Get the change's category.
326
358
fn to_category ( & self ) -> ChangeCategory {
327
359
self . max . clone ( )
@@ -464,7 +496,16 @@ impl<'tcx> ChangeSet<'tcx> {
464
496
// we only care about items that were present in both versions.
465
497
self . changes
466
498
. get ( & old)
467
- . map ( |changes| changes. to_category ( ) == Breaking )
499
+ . map ( |change| change. to_category ( ) == Breaking )
500
+ . unwrap_or ( false )
501
+ }
502
+
503
+ /// Check whether a trait item contains breaking changes preventing further analysis of it's
504
+ /// child items.
505
+ pub fn trait_item_breaking ( & self , old : DefId ) -> bool {
506
+ self . changes
507
+ . get ( & old)
508
+ . map ( |change| change. trait_item_breaking ( ) )
468
509
. unwrap_or ( false )
469
510
}
470
511
0 commit comments