@@ -78,8 +78,12 @@ fn release_profile_default_to_object() {
7878
7979 p. cargo ( "build --release --verbose -Ztrim-paths" )
8080 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
81- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
82- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
81+ . with_stderr (
82+ "\
83+ [COMPILING] foo v0.0.1 ([CWD])
84+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
85+ [FINISHED] release [..]" ,
86+ )
8387 . run ( ) ;
8488}
8589
@@ -109,8 +113,11 @@ fn one_option() {
109113 for option in [ "macro" , "diagnostics" , "object" , "all" ] {
110114 build ( option)
111115 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
112- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
113- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
116+ . with_stderr ( & format ! ( "\
117+ [COMPILING] foo v0.0.1 ([CWD])
118+ [RUNNING] `rustc [..]-Zremap-path-scope={option} --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
119+ [FINISHED] dev [..]" ,
120+ ) )
114121 . run ( ) ;
115122 }
116123 build ( "none" )
@@ -139,8 +146,12 @@ fn multiple_options() {
139146
140147 p. cargo ( "build --verbose -Ztrim-paths" )
141148 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
142- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
143- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
149+ . with_stderr (
150+ "\
151+ [COMPILING] foo v0.0.1 ([CWD])
152+ [RUNNING] `rustc [..]-Zremap-path-scope=diagnostics,macro,object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
153+ [FINISHED] dev [..]" ,
154+ )
144155 . run ( ) ;
145156}
146157
@@ -163,8 +174,10 @@ fn multiple_options_with_none() {
163174
164175 p. cargo ( "build --verbose -Ztrim-paths" )
165176 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
166- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
167- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
177+ . with_stderr_line_without (
178+ & [ "[RUNNING] `rustc [..]" ] ,
179+ & [ "-Zremap-path-scope" , "--remap-path-prefix" ] ,
180+ )
168181 . run ( ) ;
169182}
170183
@@ -193,13 +206,23 @@ fn registry_dependency() {
193206 . build ( ) ;
194207
195208 let registry_src = paths:: home ( ) . join ( ".cargo/registry/src" ) ;
196- let registry_src = registry_src. display ( ) ;
209+ let pkg_remap = format ! ( "{}/[..]/bar-0.0.1=bar-0.0.1" , registry_src. display( ) ) ;
197210
198211 p. cargo ( "run --verbose -Ztrim-paths" )
199212 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
200- . with_stdout ( format ! ( "{registry_src}/[..]/bar-0.0.1/src/lib.rs" ) )
201- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
202- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
213+ . with_stdout ( "bar-0.0.1/src/lib.rs" )
214+ . with_stderr (
215+ & format ! ( "\
216+ [UPDATING] [..]
217+ [DOWNLOADING] crates ...
218+ [DOWNLOADED] bar v0.0.1 ([..])
219+ [COMPILING] bar v0.0.1
220+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix={pkg_remap} [..]
221+ [COMPILING] foo v0.0.1 ([CWD])
222+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
223+ [FINISHED] dev [..]
224+ [RUNNING] `target/debug/foo`" ) ,
225+ )
203226 . run ( ) ;
204227}
205228
@@ -233,13 +256,21 @@ fn git_dependency() {
233256 . build ( ) ;
234257
235258 let git_checkouts_src = paths:: home ( ) . join ( ".cargo/git/checkouts" ) ;
236- let git_checkouts_src = git_checkouts_src. display ( ) ;
259+ let pkg_remap = format ! ( "{}/bar-[..]/[..]=bar-0.0.1" , git_checkouts_src. display( ) ) ;
237260
238261 p. cargo ( "run --verbose -Ztrim-paths" )
239262 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
240- . with_stdout ( format ! ( "{git_checkouts_src}/bar-[..]/[..]/src/lib.rs" ) )
241- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
242- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
263+ . with_stdout ( "bar-0.0.1/src/lib.rs" )
264+ . with_stderr (
265+ & format ! ( "\
266+ [UPDATING] git repository `{url}`
267+ [COMPILING] bar v0.0.1 ({url}[..])
268+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix={pkg_remap} [..]
269+ [COMPILING] foo v0.0.1 ([CWD])
270+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
271+ [FINISHED] dev [..]
272+ [RUNNING] `target/debug/foo`" ) ,
273+ )
243274 . run ( ) ;
244275}
245276
@@ -271,8 +302,15 @@ fn path_dependency() {
271302 p. cargo ( "run --verbose -Ztrim-paths" )
272303 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
273304 . with_stdout ( "cocktail-bar/src/lib.rs" )
274- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
275- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
305+ . with_stderr (
306+ & format ! ( "\
307+ [COMPILING] bar v0.0.1 ([..]/cocktail-bar)
308+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
309+ [COMPILING] foo v0.0.1 ([CWD])
310+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
311+ [FINISHED] dev [..]
312+ [RUNNING] `target/debug/foo`" ) ,
313+ )
276314 . run ( ) ;
277315}
278316
@@ -306,9 +344,16 @@ fn path_dependency_outside_workspace() {
306344
307345 p. cargo ( "run --verbose -Ztrim-paths" )
308346 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
309- . with_stdout ( format ! ( "{bar_path}/src/lib.rs" ) )
310- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
311- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
347+ . with_stdout ( "bar-0.0.1/src/lib.rs" )
348+ . with_stderr (
349+ & format ! ( "\
350+ [COMPILING] bar v0.0.1 ([..]/bar)
351+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix={bar_path}=bar-0.0.1 [..]
352+ [COMPILING] foo v0.0.1 ([CWD])
353+ [RUNNING] `rustc [..]-Zremap-path-scope=object --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]
354+ [FINISHED] dev [..]
355+ [RUNNING] `target/debug/foo`" ) ,
356+ )
312357 . run ( ) ;
313358}
314359
@@ -337,21 +382,25 @@ fn diagnostics_works() {
337382 . build ( ) ;
338383
339384 let registry_src = paths:: home ( ) . join ( ".cargo/registry/src" ) ;
340- let registry_src = registry_src. display ( ) ;
385+ let pkg_remap = format ! ( "{}/[..]/bar-0.0.1=bar-0.0.1" , registry_src. display( ) ) ;
341386
342387 p. cargo ( "build -vv -Ztrim-paths" )
343388 . masquerade_as_nightly_cargo ( & [ "-Ztrim-paths" ] )
344- . with_stderr_contains ( format ! (
345- "\
389+ . with_stderr_contains ( "\
346390 warning: unused variable: `unused`
347- --> {registry_src}/[..]/ bar-0.0.1/src/lib.rs:1:18
391+ --> bar-0.0.1/src/lib.rs:1:18
348392 |
349- 1 | pub fn f() {{ let unused = 0; } }
393+ 1 | pub fn f() { let unused = 0; }
350394 | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
351395 |
352396 = note: `#[warn(unused_variables)]` on by default" ,
353- ) )
354- . with_stderr_does_not_contain ( "[..]-Zremap-path-scope=[..]" )
355- . with_stderr_does_not_contain ( "[..]--remap-path-prefix=[..]" )
397+ )
398+ . with_stderr_contains (
399+ & format ! ( "\
400+ [RUNNING] [..]rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix={pkg_remap} [..]",
401+ ) )
402+ . with_stderr_contains ( "\
403+ [RUNNING] [..]rustc [..]-Zremap-path-scope=diagnostics --remap-path-prefix=[..]=/rustc/[..] --remap-path-prefix=[CWD]= [..]",
404+ )
356405 . run ( ) ;
357406}
0 commit comments