mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 14:22:50 +03:00
buildRustCrate: support proc-macro in default prelude
This commit is contained in:
parent
9e2a52f239
commit
a9fdfebc6b
@ -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}";
|
||||
|
||||
|
@ -412,6 +412,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;
|
||||
|
Loading…
Reference in New Issue
Block a user