rust/mk
bors a029ea343f Auto merge of #35957 - alexcrichton:macros-1.1, r=nrc
rustc: Implement custom derive (macros 1.1)

This commit is an implementation of [RFC 1681] which adds support to the
compiler for first-class user-define custom `#[derive]` modes with a far more
stable API than plugins have today.

[RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md

The main features added by this commit are:

* A new `rustc-macro` crate-type. This crate type represents one which will
  provide custom `derive` implementations and perhaps eventually flower into the
  implementation of macros 2.0 as well.

* A new `rustc_macro` crate in the standard distribution. This crate will
  provide the runtime interface between macro crates and the compiler. The API
  here is particularly conservative right now but has quite a bit of room to
  expand into any manner of APIs required by macro authors.

* The ability to load new derive modes through the `#[macro_use]` annotations on
  other crates.

All support added here is gated behind the `rustc_macro` feature gate, both for
the library support (the `rustc_macro` crate) as well as the language features.

There are a few minor differences from the implementation outlined in the RFC,
such as the `rustc_macro` crate being available as a dylib and all symbols are
`dlsym`'d directly instead of having a shim compiled. These should only affect
the implementation, however, not the public interface.

This commit also ended up touching a lot of code related to `#[derive]`, making
a few notable changes:

* Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
  sure how to keep this behavior and *not* expose it to custom derive.

* Derive attributes no longer have access to unstable features by default, they
  have to opt in on a granular level.

* The `derive(Copy,Clone)` optimization is now done through another "obscure
  attribute" which is just intended to ferry along in the compiler that such an
  optimization is possible. The `derive(PartialEq,Eq)` optimization was also
  updated to do something similar.

---

One part of this PR which needs to be improved before stabilizing are the errors
and exact interfaces here. The error messages are relatively poor quality and
there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
not working by default. The custom attributes added by the compiler end up
becoming unstable again when going through a custom impl.

Hopefully though this is enough to start allowing experimentation on crates.io!
2016-09-03 00:11:18 -07:00
..
cfg Auto merge of #36024 - japaric:mips64, r=alexcrichton 2016-09-02 03:01:48 -07:00
clean.mk Added missing argument to 'find' 2015-10-27 23:47:53 +13:00
crates.mk rustc: Implement custom derive (macros 1.1) 2016-09-02 12:52:56 -07:00
ctags.mk Add TAGS.rustc.emacs/TAGS.rustc.vi make targets, (re-)including rustc source. 2016-04-28 15:01:47 +02:00
debuggers.mk Distribute both rust-lldb and rust-gdb everywhere except win-msvc 2016-05-06 03:09:48 +00:00
dist.mk Produce source package in rust-installer format in addition to vanilla tarball 2016-08-12 18:13:18 +01:00
docs.mk Also remove build steps for style 2016-08-25 15:22:57 -04:00
grammar.mk Revert "mk: fix some undefined variable warnings" 2016-02-01 23:27:04 -08:00
host.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
install.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
llvm.mk llvm: allow cleaning LLVM's Visual Studio builds 2016-07-07 21:10:18 -04:00
main.mk test: Add a min-llvm-version directive 2016-09-01 16:14:17 -07:00
platform.mk [LLVM-3.9] Pass correct relocation model flag 2016-07-29 10:29:44 +02:00
prepare.mk mk: Move disable-jemalloc logic into makefiles 2016-02-25 21:05:59 -08:00
reconfig.mk mk: Bootstrap from stable instead of snapshots 2016-04-19 10:56:49 -07:00
rt.mk Fix build of compiler-rt on FreeBSD 2016-07-24 04:48:26 +00:00
rustllvm.mk Merge branch 'master' into issue-30961 2016-08-06 15:50:48 +10:00
stage0.mk mk: If local-rust is the same as the current version, then force a local-rebuild 2016-07-15 19:37:15 +02:00
target.mk mk: Fix bootstrapping cross-hosts on beta 2016-05-23 22:21:21 -07:00
tests.mk test: Add a min-llvm-version directive 2016-09-01 16:14:17 -07:00
util.mk