-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stabilize type_alias_enum_variants
in Rust 1.37.0
#61682
Merged
bors
merged 21 commits into
rust-lang:master
from
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 into
rust-lang:master
from
Centril:stabilize-type_alias_enum_variants
Jul 1, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Centril
added
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
relnotes
Marks issues that should be documented in the release notes of the next release.
labels
Jun 9, 2019
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jun 9, 2019
petrochenkov
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Jun 9, 2019
This comment has been minimized.
This comment has been minimized.
Centril
force-pushed
the
stabilize-type_alias_enum_variants
branch
from
June 10, 2019 04:23
8e11bda
to
c2cbbc3
Compare
This comment has been minimized.
This comment has been minimized.
Centril
force-pushed
the
stabilize-type_alias_enum_variants
branch
from
June 12, 2019 21:10
c2cbbc3
to
d75d14a
Compare
bors
added a commit
that referenced
this pull request
Jun 14, 2019
type_alias_enum_variants: fix #61801; allow a path pattern to infer Fix #61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc #61682 cc #49683
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jun 14, 2019
type_alias_enum_variants: fix rust-lang#61801; allow a path pattern to infer Fix rust-lang#61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc rust-lang#61682 cc rust-lang#49683
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jun 14, 2019
type_alias_enum_variants: fix rust-lang#61801; allow a path pattern to infer Fix rust-lang#61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc rust-lang#61682 cc rust-lang#49683
This comment has been minimized.
This comment has been minimized.
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jun 14, 2019
type_alias_enum_variants: fix rust-lang#61801; allow a path pattern to infer Fix rust-lang#61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc rust-lang#61682 cc rust-lang#49683
Centril
added a commit
to Centril/rust
that referenced
this pull request
Jun 14, 2019
type_alias_enum_variants: fix rust-lang#61801; allow a path pattern to infer Fix rust-lang#61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc rust-lang#61682 cc rust-lang#49683
Centril
force-pushed
the
stabilize-type_alias_enum_variants
branch
from
June 14, 2019 21:46
d75d14a
to
ccdbfda
Compare
bors
added a commit
that referenced
this pull request
Jun 15, 2019
type_alias_enum_variants: fix #61801; allow a path pattern to infer Fix #61801. Given a type-relative path pattern referring to an enum variant through a type alias, allow inferring the generic argument applied in the expectation set by the scrutinee of a `match` expression. Similar issues may exist for `let` statements but I don't know how to test for that since `PhantomData<T>` is necessary...) The gist of the problem here was that `resolve_ty_and_res_ufcs` was called twice which is apparently no good... It is possible that this PR is papering over some deeper problem, but that is beyond my knowledge of the compiler. r? @petrochenkov cc @eddyb @alexreg cc #61682 cc #49683
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Jul 1, 2019
…petrochenkov Stabilize `type_alias_enum_variants` in Rust 1.37.0 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: ```rust 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
☀️ Test successful - checks-azure, checks-travis, status-appveyor |
This was referenced Jul 1, 2019
This was referenced Jul 23, 2019
4 tasks
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Aug 29, 2019
Pkgsrc changes: * Add a patch to llvm to deal with const dli_saddr. * Adapt two other patches. * Cross-build currently fails, so i386, powerpc and sparc64 bootstrap kits for 1.37.0 are built natively. Missing aarch64 hardware, so that's not available yet. * Bump bootstrap requirements to 1.36.0 except for armv7-unknown-netbsd-eabihf which I've not managed to cross-build. Upstream changes: Version 1.37.0 (2019-08-15) ========================== Language -------- - `#[must_use]` will now warn if the type is contained in a [tuple][61100], [`Box`][62228], or an [array][62235] and unused. - [You can now use the `cfg` and `cfg_attr` attributes on generic parameters.][61547] - [You can now use enum variants through type alias.][61682] e.g. You can write the following: ```rust type MyOption = Option<u8>; fn increment_or_zero(x: MyOption) -> u8 { match x { MyOption::Some(y) => y + 1, MyOption::None => 0, } } ``` - [You can now use `_` as an identifier for consts.][61347] e.g. You can write `const _: u32 = 5;`. - [You can now use `#[repr(align(X)]` on enums.][61229] - [The `?`/_"Kleene"_ macro operator is now available in the 2015 edition.][60932] Compiler -------- - [You can now enable Profile-Guided Optimization with the `-C profile-generate` and `-C profile-use` flags.][61268] For more information on how to use profile guided optimization, please refer to the [rustc book][rustc-book-pgo]. - [The `rust-lldb` wrapper script should now work again.][61827] Libraries --------- - [`mem::MaybeUninit<T>` is now ABI-compatible with `T`.][61802] Stabilized APIs --------------- - [`BufReader::buffer`] - [`BufWriter::buffer`] - [`Cell::from_mut`] - [`Cell<[T]>::as_slice_of_cells`][`Cell<slice>::as_slice_of_cells`] - [`DoubleEndedIterator::nth_back`] - [`Option::xor`] - [`Wrapping::reverse_bits`] - [`i128::reverse_bits`] - [`i16::reverse_bits`] - [`i32::reverse_bits`] - [`i64::reverse_bits`] - [`i8::reverse_bits`] - [`isize::reverse_bits`] - [`slice::copy_within`] - [`u128::reverse_bits`] - [`u16::reverse_bits`] - [`u32::reverse_bits`] - [`u64::reverse_bits`] - [`u8::reverse_bits`] - [`usize::reverse_bits`] Cargo ----- - [`Cargo.lock` files are now included by default when publishing executable crates with executables.][cargo/7026] - [You can now specify `default-run="foo"` in `[package]` to specify the default executable to use for `cargo run`.][cargo/7056] Misc ---- Compatibility Notes ------------------- - [Using `...` for inclusive range patterns will now warn by default.][61342] Please transition your code to using the `..=` syntax for inclusive ranges instead. - [Using a trait object without the `dyn` will now warn by default.][61203] Please transition your code to use `dyn Trait` for trait objects instead. [62228]: rust-lang/rust#62228 [62235]: rust-lang/rust#62235 [61802]: rust-lang/rust#61802 [61827]: rust-lang/rust#61827 [61547]: rust-lang/rust#61547 [61682]: rust-lang/rust#61682 [61268]: rust-lang/rust#61268 [61342]: rust-lang/rust#61342 [61347]: rust-lang/rust#61347 [61100]: rust-lang/rust#61100 [61203]: rust-lang/rust#61203 [61229]: rust-lang/rust#61229 [60932]: rust-lang/rust#60932 [cargo/7026]: rust-lang/cargo#7026 [cargo/7056]: rust-lang/cargo#7056 [`BufReader::buffer`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.buffer [`BufWriter::buffer`]: https://doc.rust-lang.org/std/io/struct.BufWriter.html#method.buffer [`Cell::from_mut`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.from_mut [`Cell<slice>::as_slice_of_cells`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells [`DoubleEndedIterator::nth_back`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.nth_back [`Option::xor`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.xor [`RefCell::try_borrow_unguarded`]: https://doc.rust-lang.org/std/cell/struct.RefCell.html#method.try_borrow_unguarded [`Wrapping::reverse_bits`]: https://doc.rust-lang.org/std/num/struct.Wrapping.html#method.reverse_bits [`i128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i128.html#method.reverse_bits [`i16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i16.html#method.reverse_bits [`i32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i32.html#method.reverse_bits [`i64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i64.html#method.reverse_bits [`i8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.i8.html#method.reverse_bits [`isize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.isize.html#method.reverse_bits [`slice::copy_within`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_within [`u128::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u128.html#method.reverse_bits [`u16::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u16.html#method.reverse_bits [`u32::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u32.html#method.reverse_bits [`u64::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u64.html#method.reverse_bits [`u8::reverse_bits`]: https://doc.rust-lang.org/std/primitive.u8.html#method.reverse_bits [`usize::reverse_bits`]: https://doc.rust-lang.org/std/primitive.usize.html#method.reverse_bits [rustc-book-pgo]: https://doc.rust-lang.org/rustc/profile-guided-optimization.html
ghost
mentioned this pull request
Mar 23, 2022
This was referenced Oct 18, 2023
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, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stabilize
#![feature(type_alias_enum_variants)]
which allows type-relative resolution with highest priority toenum
variants in both expression and pattern contexts. For example, you may now write:Closes rust-lang/rfcs#2218
Closes #52118
r? @petrochenkov