File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -525,3 +525,36 @@ fn build_script_debug_assertions_override_dev() {
525525 p. cargo ( "build" )
526526 . run ( ) ;
527527}
528+
529+ #[ cargo_test]
530+ fn build_script_debug_assertions_override_release ( ) {
531+ // Test that CARGO_CFG_DEBUG_ASSERTIONS respects profile overrides
532+ // Release profile with debug-assertions explicitly ENABLED
533+ let build_rs = r#"
534+ fn main() {
535+ let has_debug_assertions = std::env::var_os("CARGO_CFG_DEBUG_ASSERTIONS").is_some();
536+ assert!(has_debug_assertions, "CARGO_CFG_DEBUG_ASSERTIONS should be set when release profile enables it");
537+ }
538+ "# ;
539+
540+ let p = project ( )
541+ . file (
542+ "Cargo.toml" ,
543+ r#"
544+ [package]
545+ name = "foo"
546+ version = "0.1.0"
547+ edition = "2024"
548+
549+ [profile.release]
550+ debug-assertions = true
551+ "# ,
552+ )
553+ . file ( "src/lib.rs" , r#""# )
554+ . file ( "build.rs" , build_rs)
555+ . build ( ) ;
556+
557+ // Release profile with debug-assertions explicitly enabled
558+ p. cargo ( "build --release" )
559+ . run ( ) ;
560+ }
You can’t perform that action at this time.
0 commit comments