@@ -9,6 +9,7 @@ use std::process::{self, Command};
9
9
10
10
const RUSTC_COLOR_ARGS : & [ & str ] = & [ "--color" , "always" ] ;
11
11
const RUSTC_EDITION_ARGS : & [ & str ] = & [ "--edition" , "2021" ] ;
12
+ const RUSTC_NO_DEBUG_ARGS : & [ & str ] = & [ "-C" , "strip=debuginfo" ] ;
12
13
const I_AM_DONE_REGEX : & str = r"(?m)^\s*///?\s*I\s+AM\s+NOT\s+DONE" ;
13
14
const CONTEXT : usize = 2 ;
14
15
const CLIPPY_CARGO_TOML_PATH : & str = "./exercises/clippy/Cargo.toml" ;
@@ -113,11 +114,13 @@ impl Exercise {
113
114
. args ( [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
114
115
. args ( RUSTC_COLOR_ARGS )
115
116
. args ( RUSTC_EDITION_ARGS )
117
+ . args ( RUSTC_NO_DEBUG_ARGS )
116
118
. output ( ) ,
117
119
Mode :: Test => Command :: new ( "rustc" )
118
120
. args ( [ "--test" , self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
119
121
. args ( RUSTC_COLOR_ARGS )
120
122
. args ( RUSTC_EDITION_ARGS )
123
+ . args ( RUSTC_NO_DEBUG_ARGS )
121
124
. output ( ) ,
122
125
Mode :: Clippy => {
123
126
let cargo_toml = format ! (
@@ -144,6 +147,7 @@ path = "{}.rs""#,
144
147
. args ( [ self . path . to_str ( ) . unwrap ( ) , "-o" , & temp_file ( ) ] )
145
148
. args ( RUSTC_COLOR_ARGS )
146
149
. args ( RUSTC_EDITION_ARGS )
150
+ . args ( RUSTC_NO_DEBUG_ARGS )
147
151
. output ( )
148
152
. expect ( "Failed to compile!" ) ;
149
153
// Due to an issue with Clippy, a cargo clean is required to catch all lints.
@@ -289,6 +293,24 @@ mod test {
289
293
assert ! ( !Path :: new( & temp_file( ) ) . exists( ) ) ;
290
294
}
291
295
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
+
292
314
#[ test]
293
315
fn test_pending_state ( ) {
294
316
let exercise = Exercise {
0 commit comments