New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a derive macro for HashStable and allow proc macros in rustc #58013

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
7 participants
@Zoxc
Copy link
Contributor

Zoxc commented Jan 30, 2019

A combination of #56864 and #56795. There were complications with using serde_derive as rustc doesn't know which crate to use for the host when there is a serde_derive in the sysroot and cargo passes another on the command line built from crates.io.

r? @eddyb (for proc macro changes) @alexcrichton (for rustbuild changes) @michaelwoerister (for the macro itself)

@Zoxc

This comment has been minimized.

Copy link
Contributor Author

Zoxc commented Jan 30, 2019

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

michaelwoerister commented Jan 31, 2019

The macro looks awesome. This should let us get rid of so much boilerplate. Also, the synstructure crate looks pretty sweet :)

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 1, 2019

I haven't been following this too too closely, but @Zoxc can you detail a bit more what some of the changes are to linking and such?

@Zoxc

This comment has been minimized.

Copy link
Contributor Author

Zoxc commented Feb 1, 2019

I'm just going to list the changes enabling proc macros.

  • We pass -Zdual-proc-macros to both cargo and rustc when cross compiling. Cargo will then build proc macros both for the host and the target and pass both to rustc for crates which depend upon them. Rustc will link to the target proc macro crate in metadata, but load the host proc macro crate and use that to execute the macros.
  • Bootstrap will now move proc macro crates compiled to the host into the sysroot at lib\rustlib\<host-triple>\lib in addition to the target crates which are moved to lib\rustlib\<target-triple>\lib
  • We require the Test target for the compiler, since that compiles libproc_macro and we need that to build proc macros used by the stage1 compiler to build stage2 compiler crates.
  • We make -Z force-unstable-if-unmarked affect proc macros too, to avoid an ICE in stability checking
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 3, 2019

☔️ The latest upstream changes (presumably #58079) made this pull request unmergeable. Please resolve the merge conflicts.

[package]
name = "rustc_macros"
version = "0.1.0"
authors = ["The Rust Project Developers"]

This comment has been minimized.

@mark-i-m

mark-i-m Feb 4, 2019

Contributor

Is it possible to make this a rust 2018 crate? Otherwise, somebody will come along and do that later for #58099 anyway, leading to more churn...

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 14, 2019

FWIW I don't think I'll have much to add any more to this, so long as it works and bootstraps seems fine by me, I wouldn't block on me for this.

@Zoxc Zoxc force-pushed the Zoxc:stable-hash-macro-simple branch from c5b0065 to 441e350 Feb 15, 2019

@Zoxc

This comment has been minimized.

Copy link
Contributor Author

Zoxc commented Feb 15, 2019

We'll need to get rust-lang/cargo#6547 into beta before this can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment