rust/src/librustdoc
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
..
clean Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
html Rollup merge of #57163 - JohnHeitmann:chevron-fix, r=estebank 2018-12-29 18:50:28 +08:00
passes Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
Cargo.toml Update minifier version 2018-10-11 21:37:04 +02:00
config.rs Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus 2018-12-29 01:22:04 +00:00
core.rs Remove licenses 2018-12-25 21:08:33 -07:00
doctree.rs Remove licenses 2018-12-25 21:08:33 -07:00
externalfiles.rs Remove licenses 2018-12-25 21:08:33 -07:00
fold.rs Remove licenses 2018-12-25 21:08:33 -07:00
lib.rs Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavus 2018-12-29 01:22:04 +00:00
markdown.rs Remove licenses 2018-12-25 21:08:33 -07:00
README.md rustc-guide has moved 2018-11-26 15:03:13 -06:00
test.rs Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
theme.rs Remove licenses 2018-12-25 21:08:33 -07:00
visit_ast.rs Store Ident rather than just Name in HIR types Item and ForeignItem. 2018-12-26 21:26:37 +00:00
visit_lib.rs Remove licenses 2018-12-25 21:08:33 -07:00

For more information about how librustdoc works, see the rustc guide.