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;
@@ -1033,8 +1033,8 @@ fn check_expected_errors(revision: Option<&str>,
10331033 expected_errors. iter ( )
10341034 . fold ( ( false , false ) ,
10351035 |( acc_help, acc_note) , ee|
1036- ( acc_help || ee. kind == "help:" || ee . kind == "help" ,
1037- acc_note || ee. kind == "note:" || ee . kind == "note" ) ) ;
1036+ ( acc_help || ee. kind == Some ( ErrorKind :: Help ) ,
1037+ acc_note || ee. kind == Some ( ErrorKind :: Note ) ) ) ;
10381038
10391039 // Scan and extract our error/warning messages,
10401040 // which look like:
@@ -1052,15 +1052,15 @@ fn check_expected_errors(revision: Option<&str>,
10521052 let mut prev = 0 ;
10531053 for ( i, ee) in expected_errors. iter ( ) . enumerate ( ) {
10541054 if !found_flags[ i] {
1055- debug ! ( "prefix={} ee.kind={} ee.msg={} line={}" ,
1055+ debug ! ( "prefix={} ee.kind={:? } ee.msg={} line={}" ,
10561056 prefixes[ i] ,
10571057 ee. kind,
10581058 ee. msg,
10591059 line) ;
10601060 // Suggestions have no line number in their output, so take on the line number of
10611061 // the previous expected error
1062- if ee. kind == "suggestion" {
1063- assert ! ( expected_errors[ prev] . kind == "help" ,
1062+ if ee. kind == Some ( ErrorKind :: Suggestion ) {
1063+ assert ! ( expected_errors[ prev] . kind == Some ( ErrorKind :: Help ) ,
10641064 "SUGGESTIONs must be preceded by a HELP" ) ;
10651065 if line. contains ( & ee. msg ) {
10661066 found_flags[ i] = true ;
@@ -1070,7 +1070,7 @@ fn check_expected_errors(revision: Option<&str>,
10701070 }
10711071 if
10721072 ( prefix_matches ( line, & prefixes[ i] ) || continuation ( line) ) &&
1073- line. contains ( & ee. kind ) &&
1073+ ( ee . kind . is_none ( ) || line. contains ( & ee. kind . as_ref ( ) . unwrap ( ) . to_string ( ) ) ) &&
10741074 line. contains ( & ee. msg )
10751075 {
10761076 found_flags[ i] = true ;
@@ -1096,7 +1096,10 @@ fn check_expected_errors(revision: Option<&str>,
10961096 if !flag {
10971097 let ee = & expected_errors[ i] ;
10981098 error ( revision, & format ! ( "expected {} on line {} not found: {}" ,
1099- ee. kind, ee. line_num, ee. msg) ) ;
1099+ ee. kind. as_ref( )
1100+ . map_or( "message" . into( ) ,
1101+ |k| k. to_string( ) ) ,
1102+ ee. line_num, ee. msg) ) ;
11001103 not_found += 1 ;
11011104 }
11021105 }
0 commit comments