rust/src/test
Manish Goregaokar 726850170d Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichton
Improve shallow `Clone` deriving

`Copy` unions now support `#[derive(Clone)]`.
Less code is generated for `#[derive(Clone, Copy)]`.
+
Unions now support `#[derive(Eq)]`.
Less code is generated for `#[derive(Eq)]`.

---
Example of code reduction:
```
enum E {
	A { a: u8, b: u16 },
	B { c: [u8; 100] },
}
```
Before:
```
fn clone(&self) -> E {
    match (&*self,) {
        (&E::A { a: ref __self_0, b: ref __self_1 },) => {
            ::std::clone::assert_receiver_is_clone(&(*__self_0));
            ::std::clone::assert_receiver_is_clone(&(*__self_1));
            *self
        }
        (&E::B { c: ref __self_0 },) => {
            ::std::clone::assert_receiver_is_clone(&(*__self_0));
            *self
        }
    }
}
```
After:
```
fn clone(&self) -> E {
    {
        let _: ::std::clone::AssertParamIsClone<u8>;
        let _: ::std::clone::AssertParamIsClone<u16>;
        let _: ::std::clone::AssertParamIsClone<[u8; 100]>;
        *self
    }
}
```

All the matches are removed, bound assertions are more lightweight.
`let _: Checker<CheckMe>;`, unlike `checker(&check_me);`, doesn't have to be translated by rustc_trans and then inlined by LLVM, it doesn't even exist in MIR, this means faster compilation.

---
Union impls are generated like this:
```
union U {
	a: u8,
	b: u16,
	c: [u8; 100],
}
```
```
fn clone(&self) -> U {
    {
        let _: ::std::clone::AssertParamIsCopy<Self>;
        *self
    }
}
```

Fixes https://github.com/rust-lang/rust/issues/36043
cc @durka
r? @alexcrichton
2016-09-15 18:16:19 +05:30
..
codegen Auto merge of #36181 - seanmonstar:likely, r=nikomatsakis 2016-09-13 10:54:55 -07:00
codegen-units rustc: move the SelfSpace before TypeSpace in Substs. 2016-08-17 05:50:57 +03:00
compile-fail Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichton 2016-09-15 18:16:19 +05:30
compile-fail-fulldeps Point compile-fail errors to the input item instead of the derive 2016-09-08 10:42:31 -07:00
debuginfo Add s390x support 2016-09-09 22:28:19 +01:00
incremental Auto merge of #35960 - nikomatsakis:incr-comp-krate-edges, r=michaelwoerister 2016-09-12 17:15:26 -07:00
mir-opt rustc: remove ParamSpace from Substs. 2016-08-17 06:32:00 +03:00
parse-fail Implement RFC#1559: allow all literals in attributes. 2016-08-25 13:25:22 -07:00
pretty Implement RFC#1559: allow all literals in attributes. 2016-08-25 13:25:22 -07:00
run-fail Auto merge of #35764 - eddyb:byegone, r=nikomatsakis 2016-08-24 14:57:34 -07:00
run-fail-fulldeps Replace local backtrace with def-use, repair std macro spans 2016-08-17 14:26:14 -07:00
run-make Link test to compiler builtins and make unstable 2016-09-13 12:27:26 -07:00
run-pass Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichton 2016-09-15 18:16:19 +05:30
run-pass-fulldeps Add regression test. 2016-09-07 07:38:29 +00:00
run-pass-valgrind Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit. 2016-08-24 13:23:37 +03:00
rustdoc Auto merge of #36293 - liigo:docblock-short, r=steveklabnik 2016-09-14 15:39:23 -07:00
ui Auto merge of #36354 - mikhail-m1:master, r=jonathandturner 2016-09-12 14:05:41 -07:00