@@ -755,6 +755,7 @@ pub struct Comparison {
755755 pub b : ArtifactDescription ,
756756 /// Statistics based on test case
757757 pub statistics : HashSet < TestResultComparison > ,
758+ /// A map from benchmark name to an error which occured when building `b` but `a`.
758759 pub new_errors : HashMap < String , String > ,
759760}
760761
@@ -790,24 +791,29 @@ impl Comparison {
790791 /// Splits comparison into primary and secondary summaries based on benchmark category
791792 pub fn summarize_by_category (
792793 self ,
793- map : HashMap < Benchmark , Category > ,
794+ category_map : HashMap < Benchmark , Category > ,
794795 ) -> ( Option < ComparisonSummary > , Option < ComparisonSummary > ) {
795796 let ( primary, secondary) = self
796797 . statistics
797798 . 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 ) ) ;
799805
800806 let primary = Comparison {
801807 a : self . a . clone ( ) ,
802808 b : self . b . clone ( ) ,
803809 statistics : primary,
804- new_errors : self . new_errors . clone ( ) ,
810+ new_errors : primary_errors ,
805811 } ;
806812 let secondary = Comparison {
807813 a : self . a ,
808814 b : self . b ,
809815 statistics : secondary,
810- new_errors : self . new_errors ,
816+ new_errors : secondary_errors ,
811817 } ;
812818 (
813819 ComparisonSummary :: summarize_comparison ( & primary) ,
0 commit comments