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;
@@ -1013,8 +1013,8 @@ fn check_expected_errors(revision: Option<&str>,
1013
1013
expected_errors. iter ( )
1014
1014
. fold ( ( false , false ) ,
1015
1015
|( 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 ) ) ) ;
1018
1018
1019
1019
// Scan and extract our error/warning messages,
1020
1020
// which look like:
@@ -1032,15 +1032,15 @@ fn check_expected_errors(revision: Option<&str>,
1032
1032
let mut prev = 0 ;
1033
1033
for ( i, ee) in expected_errors. iter ( ) . enumerate ( ) {
1034
1034
if !found_flags[ i] {
1035
- debug ! ( "prefix={} ee.kind={} ee.msg={} line={}" ,
1035
+ debug ! ( "prefix={} ee.kind={:? } ee.msg={} line={}" ,
1036
1036
prefixes[ i] ,
1037
1037
ee. kind,
1038
1038
ee. msg,
1039
1039
line) ;
1040
1040
// Suggestions have no line number in their output, so take on the line number of
1041
1041
// 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 ) ,
1044
1044
"SUGGESTIONs must be preceded by a HELP" ) ;
1045
1045
if line. contains ( & ee. msg ) {
1046
1046
found_flags[ i] = true ;
@@ -1050,7 +1050,7 @@ fn check_expected_errors(revision: Option<&str>,
1050
1050
}
1051
1051
if
1052
1052
( 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 ( ) ) ) &&
1054
1054
line. contains ( & ee. msg )
1055
1055
{
1056
1056
found_flags[ i] = true ;
@@ -1076,7 +1076,10 @@ fn check_expected_errors(revision: Option<&str>,
1076
1076
if !flag {
1077
1077
let ee = & expected_errors[ i] ;
1078
1078
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) ) ;
1080
1083
not_found += 1 ;
1081
1084
}
1082
1085
}
0 commit comments