Skip to content

Commit 7be797b

Browse files
committed
fix: force rust opt panic=unwind for tests
1 parent 4d97952 commit 7be797b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crate2nix/templates/nix/crate2nix/default.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,9 @@ rec {
370370
targetFeaturesRustcOpts = lib.lists.optional (targetFeatures != [ ])
371371
"-C target-feature=${lib.concatMapStringsSep "," (x: "+${x}") targetFeatures}";
372372

373-
profileCfg = allProfiles.${profile};
373+
profileCfg = allProfiles.${profile} // (lib.optionalAttrs runTests {
374+
panic = "unwind"; # tests require panic=unwind
375+
});
374376
depProfileRustcOpts = profileToRustcOpts profileCfg true;
375377
buildProfileRustcOpts = profileToRustcOpts
376378
(profileCfg // (profileCfg.build-override or {})) true;
@@ -466,7 +468,7 @@ rec {
466468
;
467469
}
468470
// (lib.optionalAttrs (packageId == rootPackageId) {
469-
extraRustcOpts = (profileToRustcOpts allProfiles.${profile} false) ++ targetFeaturesRustcOpts ++ globalRustcOpts;
471+
extraRustcOpts = (profileToRustcOpts profileCfg false) ++ targetFeaturesRustcOpts ++ globalRustcOpts;
470472
extraRustcOptsForBuildRs =
471473
(profileToRustcOpts (profileCfg // (profileCfg.build-override or {})) false)
472474
++ targetFeaturesRustcOpts ++ globalRustcOpts;

0 commit comments

Comments
 (0)