@@ -755,6 +755,7 @@ pub struct Comparison {
755
755
pub b : ArtifactDescription ,
756
756
/// Statistics based on test case
757
757
pub statistics : HashSet < TestResultComparison > ,
758
+ /// A map from benchmark name to an error which occured when building `b` but `a`.
758
759
pub new_errors : HashMap < String , String > ,
759
760
}
760
761
@@ -790,24 +791,29 @@ impl Comparison {
790
791
/// Splits comparison into primary and secondary summaries based on benchmark category
791
792
pub fn summarize_by_category (
792
793
self ,
793
- map : HashMap < Benchmark , Category > ,
794
+ category_map : HashMap < Benchmark , Category > ,
794
795
) -> ( Option < ComparisonSummary > , Option < ComparisonSummary > ) {
795
796
let ( primary, secondary) = self
796
797
. statistics
797
798
. into_iter ( )
798
- . partition ( |s| map. get ( & s. benchmark ( ) ) == Some ( & Category :: Primary ) ) ;
799
+ . partition ( |s| category_map. get ( & s. benchmark ( ) ) == Some ( & Category :: Primary ) ) ;
800
+
801
+ let ( primary_errors, secondary_errors) = self
802
+ . new_errors
803
+ . into_iter ( )
804
+ . partition ( |( b, _) | category_map. get ( & b. as_str ( ) . into ( ) ) == Some ( & Category :: Primary ) ) ;
799
805
800
806
let primary = Comparison {
801
807
a : self . a . clone ( ) ,
802
808
b : self . b . clone ( ) ,
803
809
statistics : primary,
804
- new_errors : self . new_errors . clone ( ) ,
810
+ new_errors : primary_errors ,
805
811
} ;
806
812
let secondary = Comparison {
807
813
a : self . a ,
808
814
b : self . b ,
809
815
statistics : secondary,
810
- new_errors : self . new_errors ,
816
+ new_errors : secondary_errors ,
811
817
} ;
812
818
(
813
819
ComparisonSummary :: summarize_comparison ( & primary) ,
0 commit comments