@@ -70,6 +70,8 @@ struct ConfigBuilder {
7070 git_hash : bool ,
7171 system_llvm : bool ,
7272 profiler_runtime : bool ,
73+ rustc_debug_assertions : bool ,
74+ std_debug_assertions : bool ,
7375}
7476
7577impl ConfigBuilder {
@@ -118,6 +120,16 @@ impl ConfigBuilder {
118120 self
119121 }
120122
123+ fn rustc_debug_assertions ( & mut self , is_enabled : bool ) -> & mut Self {
124+ self . rustc_debug_assertions = is_enabled;
125+ self
126+ }
127+
128+ fn std_debug_assertions ( & mut self , is_enabled : bool ) -> & mut Self {
129+ self . std_debug_assertions = is_enabled;
130+ self
131+ }
132+
121133 fn build ( & mut self ) -> Config {
122134 let args = & [
123135 "compiletest" ,
@@ -165,6 +177,12 @@ impl ConfigBuilder {
165177 if self . profiler_runtime {
166178 args. push ( "--profiler-runtime" . to_owned ( ) ) ;
167179 }
180+ if self . rustc_debug_assertions {
181+ args. push ( "--with-rustc-debug-assertions" . to_owned ( ) ) ;
182+ }
183+ if self . std_debug_assertions {
184+ args. push ( "--with-std-debug-assertions" . to_owned ( ) ) ;
185+ }
168186
169187 args. push ( "--rustc-path" . to_string ( ) ) ;
170188 // This is a subtle/fragile thing. On rust-lang CI, there is no global
@@ -309,6 +327,32 @@ fn only_target() {
309327 assert ! ( !check_ignore( & config, "//@ only-64bit" ) ) ;
310328}
311329
330+ #[ test]
331+ fn rustc_debug_assertions ( ) {
332+ let config: Config = cfg ( ) . rustc_debug_assertions ( false ) . build ( ) ;
333+
334+ assert ! ( check_ignore( & config, "//@ needs-rustc-debug-assertions" ) ) ;
335+ assert ! ( !check_ignore( & config, "//@ ignore-rustc-debug-assertions" ) ) ;
336+
337+ let config: Config = cfg ( ) . rustc_debug_assertions ( true ) . build ( ) ;
338+
339+ assert ! ( !check_ignore( & config, "//@ needs-rustc-debug-assertions" ) ) ;
340+ assert ! ( check_ignore( & config, "//@ ignore-rustc-debug-assertions" ) ) ;
341+ }
342+
343+ #[ test]
344+ fn std_debug_assertions ( ) {
345+ let config: Config = cfg ( ) . std_debug_assertions ( false ) . build ( ) ;
346+
347+ assert ! ( check_ignore( & config, "//@ needs-std-debug-assertions" ) ) ;
348+ assert ! ( !check_ignore( & config, "//@ ignore-std-debug-assertions" ) ) ;
349+
350+ let config: Config = cfg ( ) . std_debug_assertions ( true ) . build ( ) ;
351+
352+ assert ! ( !check_ignore( & config, "//@ needs-std-debug-assertions" ) ) ;
353+ assert ! ( check_ignore( & config, "//@ ignore-std-debug-assertions" ) ) ;
354+ }
355+
312356#[ test]
313357fn stage ( ) {
314358 let config: Config = cfg ( ) . stage_id ( "stage1-x86_64-unknown-linux-gnu" ) . build ( ) ;
0 commit comments