@@ -9,6 +9,7 @@ use std::process::{self, Command};
99
1010const RUSTC_COLOR_ARGS : & [ & str ] = & [ "--color" , "always" ] ;
1111const RUSTC_EDITION_ARGS : & [ & str ] = & [ "--edition" , "2021" ] ;
12+ const RUSTC_NO_DEBUG_ARGS : & [ & str ] = & [ "-C" , "strip=debuginfo" ] ;
1213const I_AM_DONE_REGEX : & str = r"(?m)^\s*///?\s*I\s+AM\s+NOT\s+DONE" ;
1314const CONTEXT : usize = 2 ;
1415const CLIPPY_CARGO_TOML_PATH : & str = "./exercises/clippy/Cargo.toml" ;
@@ -113,11 +114,13 @@ impl Exercise {
113114 . args ( [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
114115 . args ( RUSTC_COLOR_ARGS )
115116 . args ( RUSTC_EDITION_ARGS )
117+ . args ( RUSTC_NO_DEBUG_ARGS )
116118 . output ( ) ,
117119 Mode :: Test => Command :: new ( "rustc" )
118120 . args ( [ "--test" , self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
119121 . args ( RUSTC_COLOR_ARGS )
120122 . args ( RUSTC_EDITION_ARGS )
123+ . args ( RUSTC_NO_DEBUG_ARGS )
121124 . output ( ) ,
122125 Mode :: Clippy => {
123126 let cargo_toml = format ! (
@@ -144,6 +147,7 @@ path = "{}.rs""#,
144147 . args ( [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
145148 . args ( RUSTC_COLOR_ARGS )
146149 . args ( RUSTC_EDITION_ARGS )
150+ . args ( RUSTC_NO_DEBUG_ARGS )
147151 . output ( )
148152 . expect ( "Failed to compile!" ) ;
149153 // Due to an issue with Clippy, a cargo clean is required to catch all lints.
@@ -289,6 +293,24 @@ mod test {
289293 assert ! ( !Path :: new( & temp_file( ) ) . exists( ) ) ;
290294 }
291295
296+ #[ test]
297+ #[ cfg( target_os = "windows" ) ]
298+ fn test_no_pdb_file ( ) {
299+ [ Mode :: Compile , Mode :: Test ] // Clippy doesn't like to test
300+ . iter ( )
301+ . for_each ( |mode| {
302+ let exercise = Exercise {
303+ name : String :: from ( "example" ) ,
304+ // We want a file that does actually compile
305+ path : PathBuf :: from ( "tests/fixture/state/pending_exercise.rs" ) ,
306+ mode : * mode,
307+ hint : String :: from ( "" ) ,
308+ } ;
309+ let _ = exercise. compile ( ) . unwrap ( ) ;
310+ assert ! ( !Path :: new( & format!( "{}.pdb" , temp_file( ) ) ) . exists( ) ) ;
311+ } ) ;
312+ }
313+
292314 #[ test]
293315 fn test_pending_state ( ) {
294316 let exercise = Exercise {
0 commit comments