@@ -927,6 +927,13 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
927
927
format ! ( "{}:{}:" , testfile. display( ) , ee. line)
928
928
} ) . collect :: < Vec < String > > ( ) ;
929
929
930
+ let ( expect_help, expect_note) =
931
+ expected_errors. iter ( )
932
+ . fold ( ( false , false ) ,
933
+ |( acc_help, acc_note) , ee|
934
+ ( acc_help || ee. kind == "help:" , acc_note ||
935
+ ee. kind == "note:" ) ) ;
936
+
930
937
fn prefix_matches ( line : & str , prefix : & str ) -> bool {
931
938
use std:: ascii:: AsciiExt ;
932
939
// On windows just translate all '\' path separators to '/'
@@ -990,8 +997,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
990
997
was_expected = true ;
991
998
}
992
999
993
- if !was_expected && is_compiler_error_or_warning ( line) {
994
- fatal_proc_rec ( & format ! ( "unexpected compiler error or warning : '{}'" ,
1000
+ if !was_expected && is_unexpected_compiler_message ( line, expect_help , expect_note ) {
1001
+ fatal_proc_rec ( & format ! ( "unexpected compiler message : '{}'" ,
995
1002
line) ,
996
1003
proc_res) ;
997
1004
}
@@ -1007,16 +1014,15 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
1007
1014
}
1008
1015
}
1009
1016
1010
- fn is_compiler_error_or_warning ( line : & str ) -> bool {
1017
+ fn is_unexpected_compiler_message ( line : & str , expect_help : bool , expect_note : bool ) -> bool {
1011
1018
let mut c = Path :: new ( line) . components ( ) ;
1012
1019
let line = match c. next ( ) {
1013
1020
Some ( Component :: Prefix ( _) ) => c. as_path ( ) . to_str ( ) . unwrap ( ) ,
1014
1021
_ => line,
1015
1022
} ;
1016
1023
1017
1024
let mut i = 0 ;
1018
- return
1019
- scan_until_char ( line, ':' , & mut i) &&
1025
+ return scan_until_char ( line, ':' , & mut i) &&
1020
1026
scan_char ( line, ':' , & mut i) &&
1021
1027
scan_integer ( line, & mut i) &&
1022
1028
scan_char ( line, ':' , & mut i) &&
@@ -1028,7 +1034,10 @@ fn is_compiler_error_or_warning(line: &str) -> bool {
1028
1034
scan_integer ( line, & mut i) &&
1029
1035
scan_char ( line, ' ' , & mut i) &&
1030
1036
( scan_string ( line, "error" , & mut i) ||
1031
- scan_string ( line, "warning" , & mut i) ) ;
1037
+ scan_string ( line, "warning" , & mut i) ||
1038
+ ( expect_help && scan_string ( line, "help" , & mut i) ) ||
1039
+ ( expect_note && scan_string ( line, "note" , & mut i) )
1040
+ ) ;
1032
1041
}
1033
1042
1034
1043
fn scan_until_char ( haystack : & str , needle : char , idx : & mut usize ) -> bool {
0 commit comments