commit
26b32f1b24
3 changed files with 28 additions and 23 deletions
13
pkgs/development/compilers/rust/rustfmt-fix-self-tests.patch
Normal file
13
pkgs/development/compilers/rust/rustfmt-fix-self-tests.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
--- a/src/tools/rustfmt/src/ignore_path.rs
|
||||
+++ b/src/tools/rustfmt/src/ignore_path.rs
|
||||
@@ -37,9 +37,9 @@
|
||||
#[nightly_only_test]
|
||||
#[test]
|
||||
fn test_ignore_path_set() {
|
||||
- use std::path::{Path, PathBuf};
|
||||
use crate::config::{Config, FileName};
|
||||
use crate::ignore_path::IgnorePathSet;
|
||||
+ use std::path::{Path, PathBuf};
|
||||
|
||||
let config =
|
||||
Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new("")).unwrap();
|
|
@ -1,7 +1,7 @@
|
|||
{ lib, stdenv, rustPlatform, Security }:
|
||||
{ lib, stdenv, rustPlatform, Security, asNightly ? false }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "rustfmt";
|
||||
pname = "rustfmt" + lib.optionalString asNightly "-nightly";
|
||||
inherit (rustPlatform.rust.rustc) version src;
|
||||
|
||||
# the rust source tarball already has all the dependencies vendored, no need to fetch them again
|
||||
|
@ -19,7 +19,10 @@ rustPlatform.buildRustPackage rec {
|
|||
# As of rustc 1.45.0, these env vars are required to build rustfmt (due to
|
||||
# https://github.com/rust-lang/rust/pull/72001)
|
||||
CFG_RELEASE = rustPlatform.rust.rustc.version;
|
||||
CFG_RELEASE_CHANNEL = "stable";
|
||||
CFG_RELEASE_CHANNEL = if asNightly then "nightly" else "stable";
|
||||
|
||||
# FIXME: seems fixed upstream, remove after the next update
|
||||
patches = [ ./rustfmt-fix-self-tests.patch ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool for formatting Rust code according to style guidelines";
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{ lib, fetchFromGitHub, rustPlatform, clang, rustfmt, writeTextFile
|
||||
{ lib, fetchFromGitHub, rustPlatform, clang, rustfmt
|
||||
, runtimeShell
|
||||
, bash
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
let
|
||||
# bindgen hardcodes rustfmt outputs that use nightly features
|
||||
rustfmt-nightly = rustfmt.override { asNightly = true; };
|
||||
in rustPlatform.buildRustPackage rec {
|
||||
pname = "rust-bindgen-unwrapped";
|
||||
version = "0.59.2";
|
||||
|
||||
|
@ -25,23 +27,10 @@ rustPlatform.buildRustPackage rec {
|
|||
'';
|
||||
|
||||
doCheck = true;
|
||||
checkInputs =
|
||||
let fakeRustup = writeTextFile {
|
||||
name = "fake-rustup";
|
||||
executable = true;
|
||||
destination = "/bin/rustup";
|
||||
text = ''
|
||||
#!${runtimeShell}
|
||||
shift
|
||||
shift
|
||||
exec "$@"
|
||||
'';
|
||||
};
|
||||
in [
|
||||
rustfmt
|
||||
fakeRustup # the test suite insists in calling `rustup run nightly rustfmt`
|
||||
clang
|
||||
];
|
||||
checkInputs = [ clang ];
|
||||
|
||||
RUSTFMT = "${rustfmt-nightly}/bin/rustfmt";
|
||||
|
||||
preCheck = ''
|
||||
# for the ci folder, notably
|
||||
patchShebangs .
|
||||
|
|
Loading…
Reference in a new issue