@@ -288,16 +288,61 @@ impl PathSet {
288288 }
289289}
290290
291- const PATH_REMAP : & [ ( & str , & str ) ] = & [ ( "rust-analyzer-proc-macro-srv" , "proc-macro-srv-cli" ) ] ;
292-
293- fn remap_paths ( paths : & mut [ & Path ] ) {
294- for path in paths. iter_mut ( ) {
291+ const PATH_REMAP : & [ ( & str , & [ & str ] ) ] = & [
292+ // config.toml uses `rust-analyzer-proc-macro-srv`, but the
293+ // actual path is `proc-macro-srv-cli`
294+ ( "rust-analyzer-proc-macro-srv" , & [ "proc-macro-srv-cli" ] ) ,
295+ // Make `x test tests` function the same as `x t tests/*`
296+ (
297+ "tests" ,
298+ & [
299+ "tests/assembly" ,
300+ "tests/codegen" ,
301+ "tests/codegen-units" ,
302+ "tests/coverage" ,
303+ "tests/coverage-run-rustdoc" ,
304+ "tests/debuginfo" ,
305+ "tests/incremental" ,
306+ "tests/mir-opt" ,
307+ "tests/pretty" ,
308+ "tests/run-make" ,
309+ "tests/run-make-fulldeps" ,
310+ "tests/run-pass-valgrind" ,
311+ "tests/rustdoc" ,
312+ "tests/rustdoc-gui" ,
313+ "tests/rustdoc-js" ,
314+ "tests/rustdoc-js-std" ,
315+ "tests/rustdoc-json" ,
316+ "tests/rustdoc-ui" ,
317+ "tests/ui" ,
318+ "tests/ui-fulldeps" ,
319+ ] ,
320+ ) ,
321+ ] ;
322+
323+ fn remap_paths ( paths : & mut Vec < & Path > ) {
324+ let mut remove = vec ! [ ] ;
325+ let mut add = vec ! [ ] ;
326+ for ( i, path) in paths
327+ . iter ( )
328+ . enumerate ( )
329+ . filter_map ( |( i, path) | if let Some ( s) = path. to_str ( ) { Some ( ( i, s) ) } else { None } )
330+ {
295331 for & ( search, replace) in PATH_REMAP {
296- if path. to_str ( ) == Some ( search) {
297- * path = Path :: new ( replace)
332+ // Remove leading and trailing slashes so `tests/` and `tests` are equivalent
333+ if path. trim_matches ( std:: path:: is_separator) == search {
334+ remove. push ( i) ;
335+ add. extend ( replace. into_iter ( ) . map ( Path :: new) ) ;
336+ break ;
298337 }
299338 }
300339 }
340+ remove. sort ( ) ;
341+ remove. dedup ( ) ;
342+ for idx in remove. into_iter ( ) . rev ( ) {
343+ paths. remove ( idx) ;
344+ }
345+ paths. append ( & mut add) ;
301346}
302347
303348impl StepDescription {
0 commit comments