diff --git a/pkgs/development/tools/rust/rust-analyzer/default.nix b/pkgs/development/tools/rust/rust-analyzer/default.nix index 9df4d9075aa6..394b743ec806 100644 --- a/pkgs/development/tools/rust/rust-analyzer/default.nix +++ b/pkgs/development/tools/rust/rust-analyzer/default.nix @@ -1,8 +1,7 @@ { lib, stdenv, fetchFromGitHub, rustPlatform, CoreServices, cmake , libiconv , useMimalloc ? false -# FIXME: Test doesn't pass under rustc 1.52.1 due to different escaping of `'` in string. -, doCheck ? false +, doCheck ? true }: rustPlatform.buildRustPackage rec { @@ -17,9 +16,16 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-6Tbgy77Essi3Hyd5kdJ7JJbx7RuFZQWURfRrpScvPPQ="; }; + patches = [ + # Code format and git history check require more dependencies but don't really matter for packaging. + # So just ignore them. + ./ignore-git-and-rustfmt-tests.patch + ]; + buildAndTestSubdir = "crates/rust-analyzer"; cargoBuildFlags = lib.optional useMimalloc "--features=mimalloc"; + cargoTestFlags = lib.optional useMimalloc "--features=mimalloc"; nativeBuildInputs = lib.optional useMimalloc cmake; diff --git a/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch b/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch new file mode 100644 index 000000000000..1247e4804684 --- /dev/null +++ b/pkgs/development/tools/rust/rust-analyzer/ignore-git-and-rustfmt-tests.patch @@ -0,0 +1,18 @@ +--- a/crates/rust-analyzer/tests/slow-tests/tidy.rs ++++ b/crates/rust-analyzer/tests/slow-tests/tidy.rs +@@ -6,6 +6,7 @@ use std::{ + use xshell::{cmd, pushd, pushenv, read_file}; + + #[test] ++#[ignore] + fn check_code_formatting() { + let _dir = pushd(sourcegen::project_root()).unwrap(); + let _e = pushenv("RUSTUP_TOOLCHAIN", "stable"); +@@ -138,6 +139,7 @@ fn check_cargo_toml(path: &Path, text: String) -> () { + } + + #[test] ++#[ignore] + fn check_merge_commits() { + let stdout = cmd!("git rev-list --merges --invert-grep --author 'bors\\[bot\\]' HEAD~19..") + .read()