@@ -25,7 +25,7 @@ use std::fs::{self, File};
2525use std:: io:: BufReader ;
2626use std:: io:: prelude:: * ;
2727use std:: net:: TcpStream ;
28- use std:: path:: { Path , PathBuf } ;
28+ use std:: path:: { Path , PathBuf , Component } ;
2929use std:: process:: { Command , Output , ExitStatus } ;
3030
3131pub fn run ( config : Config , testfile : & Path ) {
@@ -952,6 +952,9 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
952952 // filename:line1:col1: line2:col2: *warning:* msg
953953 // where line1:col1: is the starting point, line2:col2:
954954 // is the ending point, and * represents ANSI color codes.
955+ //
956+ // This pattern is ambiguous on windows, because filename may contain
957+ // a colon, so any path prefix must be detected and removed first.
955958 for line in proc_res. stderr . lines ( ) {
956959 let mut was_expected = false ;
957960 let mut prev = 0 ;
@@ -1006,7 +1009,16 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
10061009 }
10071010}
10081011
1009- fn is_compiler_error_or_warning ( line : & str ) -> bool {
1012+ fn is_compiler_error_or_warning ( mut line : & str ) -> bool {
1013+ // Remove initial prefix which may contain a colon
1014+ let mut components = Path :: new ( line) . components ( ) ;
1015+ if let Some ( Component :: Prefix ( _) ) = components. peek ( ) {
1016+ components. next ( ) ;
1017+ }
1018+
1019+ // Safe as path was originally constructed from a &str ^
1020+ line = components. as_path ( ) . to_str ( ) . unwrap ( ) ;
1021+
10101022 let mut i = 0 ;
10111023 return
10121024 scan_until_char ( line, ':' , & mut i) &&
0 commit comments