@@ -74,6 +74,8 @@ struct ConfigBuilder {
7474 git_hash : bool ,
7575 system_llvm : bool ,
7676 profiler_runtime : bool ,
77+ rustc_debug_assertions : bool ,
78+ std_debug_assertions : bool ,
7779}
7880
7981impl ConfigBuilder {
@@ -122,6 +124,16 @@ impl ConfigBuilder {
122124 self
123125 }
124126
127+ fn rustc_debug_assertions ( & mut self , is_enabled : bool ) -> & mut Self {
128+ self . rustc_debug_assertions = is_enabled;
129+ self
130+ }
131+
132+ fn std_debug_assertions ( & mut self , is_enabled : bool ) -> & mut Self {
133+ self . std_debug_assertions = is_enabled;
134+ self
135+ }
136+
125137 fn build ( & mut self ) -> Config {
126138 let args = & [
127139 "compiletest" ,
@@ -169,6 +181,12 @@ impl ConfigBuilder {
169181 if self . profiler_runtime {
170182 args. push ( "--profiler-runtime" . to_owned ( ) ) ;
171183 }
184+ if self . rustc_debug_assertions {
185+ args. push ( "--with-rustc-debug-assertions" . to_owned ( ) ) ;
186+ }
187+ if self . std_debug_assertions {
188+ args. push ( "--with-std-debug-assertions" . to_owned ( ) ) ;
189+ }
172190
173191 args. push ( "--rustc-path" . to_string ( ) ) ;
174192 // This is a subtle/fragile thing. On rust-lang CI, there is no global
@@ -313,6 +331,32 @@ fn only_target() {
313331 assert ! ( !check_ignore( & config, "//@ only-64bit" ) ) ;
314332}
315333
334+ #[ test]
335+ fn rustc_debug_assertions ( ) {
336+ let config: Config = cfg ( ) . rustc_debug_assertions ( false ) . build ( ) ;
337+
338+ assert ! ( check_ignore( & config, "//@ needs-rustc-debug-assertions" ) ) ;
339+ assert ! ( !check_ignore( & config, "//@ ignore-rustc-debug-assertions" ) ) ;
340+
341+ let config: Config = cfg ( ) . rustc_debug_assertions ( true ) . build ( ) ;
342+
343+ assert ! ( !check_ignore( & config, "//@ needs-rustc-debug-assertions" ) ) ;
344+ assert ! ( check_ignore( & config, "//@ ignore-rustc-debug-assertions" ) ) ;
345+ }
346+
347+ #[ test]
348+ fn std_debug_assertions ( ) {
349+ let config: Config = cfg ( ) . std_debug_assertions ( false ) . build ( ) ;
350+
351+ assert ! ( check_ignore( & config, "//@ needs-std-debug-assertions" ) ) ;
352+ assert ! ( !check_ignore( & config, "//@ ignore-std-debug-assertions" ) ) ;
353+
354+ let config: Config = cfg ( ) . std_debug_assertions ( true ) . build ( ) ;
355+
356+ assert ! ( !check_ignore( & config, "//@ needs-std-debug-assertions" ) ) ;
357+ assert ! ( check_ignore( & config, "//@ ignore-std-debug-assertions" ) ) ;
358+ }
359+
316360#[ test]
317361fn stage ( ) {
318362 let config: Config = cfg ( ) . stage_id ( "stage1-x86_64-unknown-linux-gnu" ) . build ( ) ;
0 commit comments