11
11
use common:: Config ;
12
12
use common:: { CompileFail , ParseFail , Pretty , RunFail , RunPass , RunPassValgrind } ;
13
13
use common:: { Codegen , DebugInfoLldb , DebugInfoGdb , Rustdoc , CodegenUnits } ;
14
- use errors;
14
+ use errors:: { self , ErrorKind } ;
15
15
use header:: TestProps ;
16
16
use header;
17
17
use procsrv;
@@ -1033,8 +1033,8 @@ fn check_expected_errors(revision: Option<&str>,
1033
1033
expected_errors. iter ( )
1034
1034
. fold ( ( false , false ) ,
1035
1035
|( 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 ) ) ) ;
1038
1038
1039
1039
// Scan and extract our error/warning messages,
1040
1040
// which look like:
@@ -1052,15 +1052,15 @@ fn check_expected_errors(revision: Option<&str>,
1052
1052
let mut prev = 0 ;
1053
1053
for ( i, ee) in expected_errors. iter ( ) . enumerate ( ) {
1054
1054
if !found_flags[ i] {
1055
- debug ! ( "prefix={} ee.kind={} ee.msg={} line={}" ,
1055
+ debug ! ( "prefix={} ee.kind={:? } ee.msg={} line={}" ,
1056
1056
prefixes[ i] ,
1057
1057
ee. kind,
1058
1058
ee. msg,
1059
1059
line) ;
1060
1060
// Suggestions have no line number in their output, so take on the line number of
1061
1061
// 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 ) ,
1064
1064
"SUGGESTIONs must be preceded by a HELP" ) ;
1065
1065
if line. contains ( & ee. msg ) {
1066
1066
found_flags[ i] = true ;
@@ -1070,7 +1070,7 @@ fn check_expected_errors(revision: Option<&str>,
1070
1070
}
1071
1071
if
1072
1072
( 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 ( ) ) ) &&
1074
1074
line. contains ( & ee. msg )
1075
1075
{
1076
1076
found_flags[ i] = true ;
@@ -1096,7 +1096,10 @@ fn check_expected_errors(revision: Option<&str>,
1096
1096
if !flag {
1097
1097
let ee = & expected_errors[ i] ;
1098
1098
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) ) ;
1100
1103
not_found += 1 ;
1101
1104
}
1102
1105
}
0 commit comments