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