@@ -752,7 +752,9 @@ pub fn parse_arguments(
752752 Some ( o) => {
753753 if o. as_os_str ( )
754754 . to_string_lossy ( )
755- . ends_with ( std:: path:: MAIN_SEPARATOR )
755+ // On Windows, both '\' and '/' are valid path separators
756+ // and accepted by `cl.exe` as a delimiter
757+ . ends_with ( [ '\\' , '/' ] )
756758 {
757759 match Path :: new ( & input) . file_name ( ) {
758760 Some ( i) => outputs. insert (
@@ -1903,6 +1905,39 @@ mod test {
19031905 assert ! ( !msvc_show_includes) ;
19041906 }
19051907
1908+ #[ test]
1909+ #[ cfg( windows) ]
1910+ fn parse_argument_output_file_trailing_slash_multi_extension ( ) {
1911+ let args = ovec ! [ "/c" , "foo.pb.c" , "-Fomyrelease\\ folder/" ] ;
1912+ let ParsedArguments {
1913+ input,
1914+ language,
1915+ outputs,
1916+ preprocessor_args,
1917+ msvc_show_includes,
1918+ common_args,
1919+ ..
1920+ } = match parse_arguments ( args) {
1921+ CompilerArguments :: Ok ( args) => args,
1922+ o => panic ! ( "Got unexpected parse result: {:?}" , o) ,
1923+ } ;
1924+ assert_eq ! ( Some ( "foo.pb.c" ) , input. to_str( ) ) ;
1925+ assert_eq ! ( Language :: C , language) ;
1926+ assert_map_contains ! (
1927+ outputs,
1928+ (
1929+ "obj" ,
1930+ ArtifactDescriptor {
1931+ path: PathBuf :: from( "myrelease/folder/foo.pb.obj" ) ,
1932+ optional: false
1933+ }
1934+ )
1935+ ) ;
1936+ assert ! ( preprocessor_args. is_empty( ) ) ;
1937+ assert ! ( common_args. is_empty( ) ) ;
1938+ assert ! ( !msvc_show_includes) ;
1939+ }
1940+
19061941 #[ test]
19071942 fn test_parse_arguments_pdb ( ) {
19081943 let args = ovec ! [ "-c" , "foo.c" , "-Zi" , "-Fdfoo.pdb" , "-Fofoo.obj" ] ;
0 commit comments