88//! very new but replaces the manually implemented `BoolExt` trait.
99
1010use std:: ffi:: OsString ;
11+ #[ cfg( feature = "debug-probe" ) ]
1112use std:: fmt;
13+ #[ cfg( feature = "debug-probe" ) ]
1214use std:: fmt:: Write ;
1315use std:: fs;
1416use std:: io:: ErrorKind ;
@@ -125,7 +127,9 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
125127 }
126128 }
127129
130+ #[ cfg( feature = "debug-probe" ) ]
128131 let debug = rustc_probe_debug ( ) ;
132+ #[ cfg( feature = "debug-probe" ) ]
129133 if debug {
130134 let mut msg = String :: new ( ) ;
131135 write_command ( & mut msg, & cmd) . expect ( "write to string does not fail" ) ;
@@ -141,10 +145,14 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
141145 // Clean up to avoid leaving nondeterministic absolute paths in the dep-info
142146 // file in OUT_DIR, which causes nonreproducible builds in build systems
143147 // that treat the entire OUT_DIR as an artifact.
148+ #[ cfg( feature = "debug-probe" ) ]
144149 if !debug {
145150 rmrf ( & out_subdir) ;
146151 }
147152
153+ #[ cfg( not( feature = "debug-probe" ) ) ]
154+ rmrf ( & out_subdir) ;
155+
148156 success
149157}
150158
@@ -198,6 +206,7 @@ fn rustc_command() -> Command {
198206 }
199207}
200208
209+ #[ cfg( feature = "debug-probe" ) ]
201210fn rustc_probe_debug ( ) -> bool {
202211 fn is_falsy ( mut s : OsString ) -> bool {
203212 if s. len ( ) <= 5 {
@@ -216,6 +225,7 @@ fn rustc_probe_debug() -> bool {
216225 }
217226}
218227
228+ #[ cfg( feature = "debug-probe" ) ]
219229fn write_command ( out : & mut impl Write , cmd : & Command ) -> fmt:: Result {
220230 writeln ! ( out, "Running RUSTC command:" ) ?;
221231 if let Some ( cwd) = cmd. get_current_dir ( ) {
0 commit comments