Skip to content

Stabilize type_alias_enum_variants in Rust 1.37.0#61682

Merged
bors merged 21 commits intorust-lang:masterfrom
Centril:stabilize-type_alias_enum_variants
Jul 1, 2019
Merged

Stabilize type_alias_enum_variants in Rust 1.37.0#61682
bors merged 21 commits intorust-lang:masterfrom
Centril:stabilize-type_alias_enum_variants

Conversation

@Centril
Copy link
Contributor

@Centril Centril commented Jun 9, 2019

Stabilize #![feature(type_alias_enum_variants)] which allows type-relative resolution with highest priority to enum variants in both expression and pattern contexts. For example, you may now write:

enum Option<T> {
    None,
    Some(T),
}

type OptAlias<T> = Option<T>;

fn work_on_alias(x: Option<u8>) -> u8 {
    match x {
        OptAlias::Some(y) => y + 1,
        OptAlias::None => 0,
    }
}

Closes rust-lang/rfcs#2218
Closes #52118

r? @petrochenkov

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using variant on self type with path Self::Variant causes subpar diagnostic Generics: Make enum variant syntax consistent with other types

10 participants