Merge pull request #85172 from andir/buildRustCrate-proc-macro
buildRustCrate: support proc-macro in default prelude
This commit is contained in:
commit
84b91899c3
|
@ -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}";
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue