rust/src/test
bors e1d7e4ae82 Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasper
Move special treatment of `derive(Copy, PartialEq, Eq)` from expansion infrastructure to elsewhere

As described in https://github.com/rust-lang/rust/pull/62086#issuecomment-515195477.

Reminder:
- `derive(PartialEq, Eq)` makes the type it applied to a "structural match" type, so constants of this type can be used in patterns (and const generics in the future).
- `derive(Copy)` notifies other derives that the type it applied to implements `Copy`, so `derive(Clone)` can generate optimized code and other derives can generate code working with `packed` types and types with `rustc_layout_scalar_valid_range` attributes.

First, the special behavior is now enabled after properly resolving the derives, rather than after textually comparing them with `"Copy"`, `"PartialEq"` and `"Eq"` in `fn add_derived_markers`.

The markers are no longer kept as attributes in AST since derives cannot modify items and previously did it through hacks in the expansion infra.
Instead, the markers are now kept in a "global context" available from all the necessary places, namely - resolver.

For `derive(PartialEq, Eq)` the markers are created by the derive macros themselves and then consumed during HIR lowering to add the `#[structural_match]` attribute in HIR.
This is still a hack, but now it's a hack local to two specific macros rather than affecting the whole expansion infra.
Ideally we should find the way to put `#[structural_match]` on the impls rather than on the original item, and then consume it in `rustc_mir`, then no hacks in expansion and lowering will be required.
(I'll make an issue about this for someone else to solve, after this PR lands.)

The marker for `derive(Copy)` cannot be emitted by the `Copy` macro itself because we need to know it *before* the `Copy` macro is expanded for expanding other macros.
So we have to do it in resolve and block expansion of any derives in a `derive(...)` container until we know for sure whether this container has `Copy` in it or not.
Nasty stuff.

r? @eddyb or @matthewjasper
2019-08-05 04:36:51 +00:00
..
assembly Ignore NVPTX tests 2019-06-12 23:09:08 +02:00
auxiliary rustc_target: avoid negative register counts in the SysV x86_64 ABI. 2019-07-05 13:24:25 +03:00
codegen Auto merge of #62592 - nikic:actually-update-llvm, r=alexcrichton 2019-07-16 23:05:06 +00:00
codegen-units
compile-fail rustc_mir: follow FalseUnwind's real_target edge in qualify_consts. 2019-07-11 12:28:02 +03:00
debuginfo Fix CDB support tidy check line length failures. 2019-05-20 02:44:26 -07:00
incremental normalize use of backticks in compiler messages for librustc_incremental 2019-07-20 20:57:45 +02:00
mir-opt const_prop no longer does ptr-to-int casts 2019-08-02 23:04:11 +02:00
pretty pprust: Support macro macros 2019-07-15 12:42:07 +03:00
run-fail compiletest: Validate pass modes harder 2019-06-16 12:23:22 +03:00
run-make Add very simple edition check to tidy; and add missing edition = 2018s. 2019-07-30 01:56:03 +08:00
run-make-fulldeps Remove derives Encodable/Decodable and unstabilize attribute #[bench] 2019-07-31 21:27:59 +03:00
run-pass-valgrind Added ignore-sgx for appropriate tests 2019-05-16 14:29:12 -07:00
rustdoc Auto merge of #63048 - Aaron1011:feature/rustdoc-reexport-doc, r=GuillaumeGomez 2019-08-04 11:30:12 +00:00
rustdoc-js
rustdoc-js-std
rustdoc-ui Replace abstract type with type alias impl Trait 2019-08-02 02:44:36 +01:00
rustfix
ui Auto merge of #63248 - petrochenkov:nomarker, r=matthewjasper 2019-08-05 04:36:51 +00:00
ui-fulldeps Rollup merge of #63146 - Mark-Simulacrum:clean-attr, r=petrochenkov 2019-08-03 13:11:59 +02:00
COMPILER_TESTS.md