diff options
author | John Ericson <git@JohnEricson.me> | 2020-04-13 22:17:15 -0400 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2020-04-13 22:17:15 -0400 |
commit | c8a6ea5161404792e25e6c4c274ef2cfaadbcb91 (patch) | |
tree | f1295b077c28b18e631459531151db2b77f2ca60 /pkgs/build-support | |
parent | cff16451b1729c3e509f0b7467eabd5c455082d2 (diff) | |
parent | 40000ebb4bc11948b7cb551237ee9d4f3ccbd5ae (diff) |
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/build-crate.nix | 3 | ||||
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/test/default.nix | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/pkgs/build-support/rust/build-rust-crate/build-crate.nix index 9759235e30e37..d6d1cebb2e91b 100644 --- a/pkgs/build-support/rust/build-rust-crate/build-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/build-crate.nix @@ -16,6 +16,9 @@ ++ [crateFeatures] ++ extraRustcOpts ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "--target ${rust.toRustTarget stdenv.hostPlatform} -C linker=${stdenv.hostPlatform.config}-gcc" + # since rustc 1.42 the "proc_macro" crate is part of the default crate prelude + # https://github.com/rust-lang/cargo/commit/4d64eb99a4#diff-7f98585dbf9d30aa100c8318e2c77e79R1021-R1022 + ++ lib.optional (lib.elem "proc-macro" crateType) "--extern proc_macro" ; rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}"; diff --git a/pkgs/build-support/rust/build-rust-crate/test/default.nix b/pkgs/build-support/rust/build-rust-crate/test/default.nix index 4783129bad9a9..5597e4b0dd66a 100644 --- a/pkgs/build-support/rust/build-rust-crate/test/default.nix +++ b/pkgs/build-support/rust/build-rust-crate/test/default.nix @@ -457,6 +457,18 @@ let "test ignore_main ... ok" ]; }; + procMacroInPrelude = { + procMacro = true; + edition = "2018"; + src = symlinkJoin { + name = "proc-macro-in-prelude"; + paths = [ + (mkFile "src/lib.rs" '' + use proc_macro::TokenTree; + '') + ]; + }; + }; }; brotliCrates = (callPackage ./brotli-crates.nix {}); tests = lib.mapAttrs (key: value: mkTest (value // lib.optionalAttrs (!value?crateName) { crateName = key; })) cases; |