1111use common:: Config ;
1212use common:: { CompileFail , ParseFail , Pretty , RunFail , RunPass , RunPassValgrind } ;
1313use common:: { Codegen , DebugInfoLldb , DebugInfoGdb , Rustdoc , CodegenUnits } ;
14- use errors;
14+ use errors:: { self , ErrorKind } ;
1515use header:: TestProps ;
1616use header;
1717use procsrv;
@@ -1013,8 +1013,8 @@ fn check_expected_errors(revision: Option<&str>,
10131013 expected_errors. iter ( )
10141014 . fold ( ( false , false ) ,
10151015 |( acc_help, acc_note) , ee|
1016- ( acc_help || ee. kind == "help:" || ee . kind == "help" ,
1017- acc_note || ee. kind == "note:" || ee . kind == "note" ) ) ;
1016+ ( acc_help || ee. kind == Some ( ErrorKind :: Help ) ,
1017+ acc_note || ee. kind == Some ( ErrorKind :: Note ) ) ) ;
10181018
10191019 // Scan and extract our error/warning messages,
10201020 // which look like:
@@ -1032,15 +1032,15 @@ fn check_expected_errors(revision: Option<&str>,
10321032 let mut prev = 0 ;
10331033 for ( i, ee) in expected_errors. iter ( ) . enumerate ( ) {
10341034 if !found_flags[ i] {
1035- debug ! ( "prefix={} ee.kind={} ee.msg={} line={}" ,
1035+ debug ! ( "prefix={} ee.kind={:? } ee.msg={} line={}" ,
10361036 prefixes[ i] ,
10371037 ee. kind,
10381038 ee. msg,
10391039 line) ;
10401040 // Suggestions have no line number in their output, so take on the line number of
10411041 // the previous expected error
1042- if ee. kind == "suggestion" {
1043- assert ! ( expected_errors[ prev] . kind == "help" ,
1042+ if ee. kind == Some ( ErrorKind :: Suggestion ) {
1043+ assert ! ( expected_errors[ prev] . kind == Some ( ErrorKind :: Help ) ,
10441044 "SUGGESTIONs must be preceded by a HELP" ) ;
10451045 if line. contains ( & ee. msg ) {
10461046 found_flags[ i] = true ;
@@ -1050,7 +1050,7 @@ fn check_expected_errors(revision: Option<&str>,
10501050 }
10511051 if
10521052 ( prefix_matches ( line, & prefixes[ i] ) || continuation ( line) ) &&
1053- line. contains ( & ee. kind ) &&
1053+ ( ee . kind . is_none ( ) || line. contains ( & ee. kind . as_ref ( ) . unwrap ( ) . to_string ( ) ) ) &&
10541054 line. contains ( & ee. msg )
10551055 {
10561056 found_flags[ i] = true ;
@@ -1076,7 +1076,10 @@ fn check_expected_errors(revision: Option<&str>,
10761076 if !flag {
10771077 let ee = & expected_errors[ i] ;
10781078 error ( revision, & format ! ( "expected {} on line {} not found: {}" ,
1079- ee. kind, ee. line_num, ee. msg) ) ;
1079+ ee. kind. as_ref( )
1080+ . map_or( "message" . into( ) ,
1081+ |k| k. to_string( ) ) ,
1082+ ee. line_num, ee. msg) ) ;
10801083 not_found += 1 ;
10811084 }
10821085 }
0 commit comments