diff --git a/pkgs/development/tools/rust/cbindgen/1010-fix-test-failures-due-to-CARGO_BUILD_TARGET.patch b/pkgs/development/tools/rust/cbindgen/1010-fix-test-failures-due-to-CARGO_BUILD_TARGET.patch deleted file mode 100644 index 85baa4fd03e0..000000000000 --- a/pkgs/development/tools/rust/cbindgen/1010-fix-test-failures-due-to-CARGO_BUILD_TARGET.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff --git a/tests/profile.rs b/tests/profile.rs -index 69433a2..596829d 100644 ---- a/tests/profile.rs -+++ b/tests/profile.rs -@@ -1,6 +1,7 @@ - use cbindgen::*; - - use serial_test::serial; -+use std::env; - use std::path::{Path, PathBuf}; - use std::process::Command; - -@@ -17,7 +18,12 @@ fn build_using_lib(config: fn(Builder) -> Builder) -> tempfile::TempDir { - .tempdir() - .expect("Creating tmp dir failed"); - -- std::env::set_var("CARGO_EXPAND_TARGET_DIR", tmp_dir.path()); -+ unsafe { -+ env::set_var("CARGO_EXPAND_TARGET_DIR", tmp_dir.path()); -+ env::remove_var("CARGO_BUILD_TARGET"); -+ // ^ avoid unexpected change of layout of the target directory; -+ // ... see: https://doc.rust-lang.org/cargo/guide/build-cache.html -+ } - let builder = Builder::new() - .with_config(Config::from_file(expand_dep_test_dir.join("cbindgen.toml")).unwrap()) - .with_crate(expand_dep_test_dir); -@@ -45,6 +51,9 @@ fn build_using_bin(extra_args: &[&str]) -> tempfile::TempDir { - Command::new(cbindgen_path) - .current_dir(expand_dep_test_dir) - .env("CARGO_EXPAND_TARGET_DIR", tmp_dir.path()) -+ .env_remove("CARGO_BUILD_TARGET") -+ // ^ avoid unexpected change of layout of the target directory; -+ // ... see: https://doc.rust-lang.org/cargo/guide/build-cache.html - .args(extra_args) - .output() - .expect("build should succeed"); -@@ -87,6 +96,19 @@ fn bin_default_uses_debug_build() { - assert_eq!(get_contents_of_dir(target_dir.path()), &["debug"]); - } - -+#[test] -+fn bin_ignore_cargo_build_target_in_tests() { -+ unsafe { -+ env::set_var("CARGO_BUILD_TARGET", "x86_64-unknown-linux-gnu"); -+ } -+ assert_eq!( -+ env::var("CARGO_BUILD_TARGET"), -+ Ok("x86_64-unknown-linux-gnu".into()) -+ ); -+ // ^ this env var should be ignored: -+ bin_default_uses_debug_build(); -+} -+ - #[test] - fn bin_explicit_debug_build() { - let target_dir = build_using_bin(&["--profile", "debug"]); diff --git a/pkgs/development/tools/rust/cbindgen/default.nix b/pkgs/development/tools/rust/cbindgen/default.nix index fa3b9fb98b78..6dc834822d4a 100644 --- a/pkgs/development/tools/rust/cbindgen/default.nix +++ b/pkgs/development/tools/rust/cbindgen/default.nix @@ -14,22 +14,16 @@ rustPlatform.buildRustPackage rec { pname = "rust-cbindgen"; - version = "0.27.0"; + version = "0.28.0"; src = fetchFromGitHub { owner = "mozilla"; repo = "cbindgen"; rev = "v${version}"; - hash = "sha256-XTGHHD5Qw3mr+lkPKOXyqb0K3sEENW8Sf0n9mtrFFXI="; + hash = "sha256-1GT+EgltLhveEACxhY+748L1HIIyQHbEs7wLKANFWr0="; }; - patches = [ - # open PR: https://github.com/mozilla/cbindgen/pull/1010 - # see also: https://github.com/NixOS/nixpkgs/pull/298108 - ./1010-fix-test-failures-due-to-CARGO_BUILD_TARGET.patch - ]; - - cargoHash = "sha256-l4FgwXdibek4BAnqjWd1rLxpEwuMNjYgvo6X3SS3fRo="; + cargoHash = "sha256-VaM2+az881qePMqkQRxVxoXCgrgPC8LqSQNDst1bnkY="; buildInputs = lib.optional stdenv.hostPlatform.isDarwin Security;