rust/src/test
bors 59183180f7 Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov
Implement RFC 2338, "Type alias enum variants"

This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.

```rust
#![feature(type_alias_enum_variants)]

enum Foo {
    Bar(i32),
    Baz { i: i32 },
}

type Alias = Foo;

fn main() {
    let t = Alias::Bar(0);
    let t = Alias::Baz { i: 0 };
    match t {
        Alias::Bar(_i) => {}
        Alias::Baz { i: _i } => {}
    }
}
```

Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.

Fixes issues #56199 and #56611.

N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.

```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```

I do not know if this will need an FCP, but let's start one if so.
2018-12-29 21:03:11 +00:00
..
auxiliary Remove licenses 2018-12-25 21:08:33 -07:00
codegen Remove licenses 2018-12-25 21:08:33 -07:00
codegen-units Remove licenses 2018-12-25 21:08:33 -07:00
compile-fail Auto merge of #56999 - petrochenkov:macrecov2, r=estebank 2018-12-27 22:27:27 +00:00
compile-fail-fulldeps/auxiliary Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
debuginfo Remove licenses 2018-12-25 21:08:33 -07:00
incremental Remove licenses 2018-12-25 21:08:33 -07:00
mir-opt Remove licenses 2018-12-25 21:08:33 -07:00
pretty Remove licenses 2018-12-25 21:08:33 -07:00
run-fail Remove licenses 2018-12-25 21:08:33 -07:00
run-fail-fulldeps Remove licenses 2018-12-25 21:08:33 -07:00
run-make Remove licenses 2018-12-25 21:08:33 -07:00
run-make-fulldeps Remove licenses 2018-12-25 21:08:33 -07:00
run-pass Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov 2018-12-29 21:03:11 +00:00
run-pass-fulldeps Get rid of Block::recovered 2018-12-27 15:51:36 +03:00
run-pass-valgrind Remove licenses 2018-12-25 21:08:33 -07:00
rustdoc Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus 2018-12-29 01:22:04 +00:00
rustdoc-js Remove licenses 2018-12-25 21:08:33 -07:00
rustdoc-ui Remove licenses 2018-12-25 21:08:33 -07:00
rustfix Remove licenses 2018-12-25 21:08:33 -07:00
ui Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkov 2018-12-29 21:03:11 +00:00
ui-fulldeps Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
COMPILER_TESTS.md rustc-guide has moved 2018-11-26 15:03:13 -06:00