Skip to content
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 or_patterns (RFC 2535, 2530, 2175) #79278

Merged
merged 6 commits into from
Mar 22, 2021

Conversation

mark-i-m
Copy link
Member

@mark-i-m mark-i-m commented Nov 21, 2020

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):

EDIT: Stabilization report is in #79278 (comment)

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 21, 2020
@mark-i-m
Copy link
Member Author

r? @petrochenkov

@mark-i-m

This comment has been minimized.

@jonas-schievink jonas-schievink added relnotes Marks issues that should be documented in the release notes of the next release. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Nov 21, 2020
@petrochenkov petrochenkov added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 21, 2020
@est31
Copy link
Member

est31 commented Nov 22, 2020

@mark-i-m it's only not needed when you stabilize a std feature as std is always compiled first.

@mark-i-m
Copy link
Member Author

@est31 Do you happen to know how to bless clippy tests? Everything is passing locally on stage 2.

@est31
Copy link
Member

est31 commented Nov 23, 2020

@mark-i-m sorry no idea off the top of my head. IIRC the compiletest code creates the files on the disk and you only have to copy them to the right location. bless is only a wrapper around that, but no idea whether clippy has better facilities than manual copies.

@camelid
Copy link
Member

camelid commented Nov 23, 2020

@est31 Do you happen to know how to bless clippy tests? Everything is passing locally on stage 2.

Unfortunately you can't bless Clippy tests in-tree :/

I just asked about this the other day in #clippy.

@mark-i-m
Copy link
Member Author

@camelid I see. So what should one do with the CI failure? Does it just stay that way?

@camelid
Copy link
Member

camelid commented Nov 24, 2020

I think you might need to update by hand :/

@bors

This comment has been minimized.

@mark-i-m mark-i-m marked this pull request as ready for review November 26, 2020 19:51
@mark-i-m mark-i-m force-pushed the stabilize-or-pattern branch 2 times, most recently from 96c1210 to eb50210 Compare November 28, 2020 22:59
@bors

This comment has been minimized.

@bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors

This comment has been minimized.

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Mar 25, 2021
Stabilize or_patterns (RFC 2535, 2530, 2175)

closes #54883

This PR stabilizes the or_patterns feature in Rust 1.53.

This is blocked on the following (in order):
- [x] The crater run in rust-lang/rust#78935 (comment)
- [x] The resolution of the unresolved questions and a second crater run (rust-lang/rust#78935 (comment))
    - It looks like we will need to pursue some sort of edition-based transition for `:pat`.
- [x] Nomination and discussion by T-lang
- [x] Implement new behavior for `:pat` based on consensus (rust-lang/rust#80100).
- [ ] An FCP on stabilization

EDIT: Stabilization report is in rust-lang/rust#79278 (comment)
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Mar 26, 2021
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Apr 4, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2021
…sakis

Stabilize `:pat_param` and remove `:pat2021`

Blocked on rust-lang#83384

cc `@rust-lang/lang` rust-lang#79278

If I understand `@nikomatsakis` in  https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873, another FCP is not needed.

r? `@nikomatsakis`
@mark-i-m mark-i-m deleted the stabilize-or-pattern branch April 29, 2021 01:28
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request Jun 20, 2021
Pkgsrc changes:
 * Bump bootstrap requirements to 1.52.1
 * Adjust patches, adapt to upstream changes, adjust cargo checksums
 * If using an external llvm, require >= 10.0

Upsteream changes:

Version 1.53.0 (2021-06-17)
============================

Language
-----------------------
- [You can now use unicode for identifiers.][83799] This allows
  multilingual identifiers but still doesn't allow glyphs that are
  not considered characters such as `#` (diamond) or `<U+1F980>`
  (crab). More specifically you can now use any identifier that
  matches the UAX #31 "Unicode Identifier and Pattern Syntax" standard. This
  is the same standard as languages like Python, however Rust uses NFC
  normalization which may be different from other languages.
- [You can now specify "or patterns" inside pattern matches.][79278]
  Previously you could only use `|` (OR) on complete patterns. E.g.
  ```rust
  let x = Some(2u8);
  // Before
  matches!(x, Some(1) | Some(2));
  // Now
  matches!(x, Some(1 | 2));
  ```
- [Added the `:pat_param` `macro_rules!` matcher.][83386] This matcher
  has the same semantics as the `:pat` matcher. This is to allow `:pat`
  to change semantics to being a pattern fragment in a future edition.

Compiler
-----------------------
- [Updated the minimum external LLVM version to LLVM 10.][83387]
- [Added Tier 3\* support for the `wasm64-unknown-unknown` target.][80525]
- [Improved debuginfo for closures and async functions on Windows MSVC.][83941]

\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.

Libraries
-----------------------
- [Abort messages will now forward to `android_set_abort_message` on
  Android platforms when available.][81469]
- [`slice::IterMut<'_, T>` now implements `AsRef<[T]>`][82771]
- [Arrays of any length now implement `IntoIterator`.][84147]
  Currently calling `.into_iter()` as a method on an array will
  return `impl Iterator<Item=&T>`, but this may change in a
  future edition to change `Item` to `T`. Calling `IntoIterator::into_iter`
  directly on arrays will provide `impl Iterator<Item=T>` as expected.
- [`leading_zeros`, and `trailing_zeros` are now available on all
  `NonZero` integer types.][84082]
- [`{f32, f64}::from_str` now parse and print special values
  (`NaN`, `-0`) according to IEEE RFC 754.][78618]
- [You can now index into slices using `(Bound<usize>, Bound<usize>)`.][77704]
- [Add the `BITS` associated constant to all numeric types.][82565]

Stabilised APIs
---------------
- [`AtomicBool::fetch_update`]
- [`AtomicPtr::fetch_update`]
- [`BTreeMap::retain`]
- [`BTreeSet::retain`]
- [`BufReader::seek_relative`]
- [`DebugStruct::non_exhaustive`]
- [`Duration::MAX`]
- [`Duration::ZERO`]
- [`Duration::is_zero`]
- [`Duration::saturating_add`]
- [`Duration::saturating_mul`]
- [`Duration::saturating_sub`]
- [`ErrorKind::Unsupported`]
- [`Option::insert`]
- [`Ordering::is_eq`]
- [`Ordering::is_ge`]
- [`Ordering::is_gt`]
- [`Ordering::is_le`]
- [`Ordering::is_lt`]
- [`Ordering::is_ne`]
- [`OsStr::is_ascii`]
- [`OsStr::make_ascii_lowercase`]
- [`OsStr::make_ascii_uppercase`]
- [`OsStr::to_ascii_lowercase`]
- [`OsStr::to_ascii_uppercase`]
- [`Peekable::peek_mut`]
- [`Rc::decrement_strong_count`]
- [`Rc::increment_strong_count`]
- [`Vec::extend_from_within`]
- [`array::from_mut`]
- [`array::from_ref`]
- [`char::MAX`]
- [`char::REPLACEMENT_CHARACTER`]
- [`char::UNICODE_VERSION`]
- [`char::decode_utf16`]
- [`char::from_digit`]
- [`char::from_u32_unchecked`]
- [`char::from_u32`]
- [`cmp::max_by_key`]
- [`cmp::max_by`]
- [`cmp::min_by_key`]
- [`cmp::min_by`]
- [`f32::is_subnormal`]
- [`f64::is_subnormal`]

Cargo
-----------------------
- [Cargo now supports git repositories where the default `HEAD` branch is not
  "master".][cargo/9392] This also includes a switch to the version
  3 `Cargo.lock` format which can handle default branches correctly.
- [macOS targets now default to `unpacked` split-debuginfo.][cargo/9298]
- [The `authors` field is no longer included in `Cargo.toml` for new
  projects.][cargo/9282]

Rustdoc
-----------------------
- [Added the `rustdoc::bare_urls` lint that warns when you have URLs
  without hyperlinks.][81764]

Compatibility Notes
-------------------
- [Implement token-based handling of attributes during expansion][82608]
- [`Ipv4::from_str` will now reject octal format IP addresses in addition
  to rejecting hexadecimal IP addresses.][83652] The octal format can lead
  to confusion and potential security vulnerabilities and [is no
  longer recommended][ietf6943].

Internal Only
-------------
These changes provide no direct user facing benefits, but represent significant
improvements to the internals and overall performance of rustc and
related tools.

- [Rework the `std::sys::windows::alloc` implementation.][83065]
- [rustdoc: Don't enter an infer_ctxt in get_blanket_impls for
  impls that aren't blanket impls.][82864]
- [rustdoc: Only look at blanket impls in `get_blanket_impls`][83681]
- [Rework rustdoc const type][82873]

[83386]: rust-lang/rust#83386
[82771]: rust-lang/rust#82771
[84147]: rust-lang/rust#84147
[84082]: rust-lang/rust#84082
[83799]: rust-lang/rust#83799
[83681]: rust-lang/rust#83681
[83652]: rust-lang/rust#83652
[83387]: rust-lang/rust#83387
[82873]: rust-lang/rust#82873
[82864]: rust-lang/rust#82864
[82608]: rust-lang/rust#82608
[82565]: rust-lang/rust#82565
[80525]: rust-lang/rust#80525
[79278]: rust-lang/rust#79278
[78618]: rust-lang/rust#78618
[77704]: rust-lang/rust#77704
[83941]: rust-lang/rust#83941
[83065]: rust-lang/rust#83065
[81764]: rust-lang/rust#81764
[81469]: rust-lang/rust#81469
[cargo/9298]: rust-lang/cargo#9298
[cargo/9282]: rust-lang/cargo#9282
[cargo/9392]: rust-lang/cargo#9392
[`char::MAX`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX
[`char::REPLACEMENT_CHARACTER`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER
[`char::UNICODE_VERSION`]: https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION
[`char::decode_utf16`]: https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16
[`char::from_u32`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32
[`char::from_u32_unchecked`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked
[`char::from_digit`]: https://doc.rust-lang.org/std/primitive.char.html#method.from_digit
[`AtomicBool::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicBool.html#method.fetch_update
[`AtomicPtr::fetch_update`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicPtr.html#method.fetch_update
[`BTreeMap::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.retain
[`BTreeSet::retain`]: https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.retain
[`BufReader::seek_relative`]: https://doc.rust-lang.org/std/io/struct.BufReader.html#method.seek_relative
[`DebugStruct::non_exhaustive`]: https://doc.rust-lang.org/std/fmt/struct.DebugStruct.html#method.finish_non_exhaustive
[`Duration::MAX`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.MAX
[`Duration::ZERO`]: https://doc.rust-lang.org/std/time/struct.Duration.html#associatedconstant.ZERO
[`Duration::is_zero`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.is_zero
[`Duration::saturating_add`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_add
[`Duration::saturating_mul`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_mul
[`Duration::saturating_sub`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.saturating_sub
[`ErrorKind::Unsupported`]: https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.Unsupported
[`Option::insert`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.insert
[`Ordering::is_eq`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_eq
[`Ordering::is_ge`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ge
[`Ordering::is_gt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_gt
[`Ordering::is_le`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_le
[`Ordering::is_lt`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_lt
[`Ordering::is_ne`]: https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.is_ne
[`OsStr::eq_ignore_ascii_case`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.eq_ignore_ascii_case
[`OsStr::is_ascii`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.is_ascii
[`OsStr::make_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_lowercase
[`OsStr::make_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.make_ascii_uppercase
[`OsStr::to_ascii_lowercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_lowercase
[`OsStr::to_ascii_uppercase`]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.to_ascii_uppercase
[`Peekable::peek_mut`]: https://doc.rust-lang.org/std/iter/struct.Peekable.html#method.peek_mut
[`Rc::decrement_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
[`Rc::increment_strong_count`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.increment_strong_count
[`Vec::extend_from_within`]: https://doc.rust-lang.org/beta/std/vec/struct.Vec.html#method.extend_from_within
[`array::from_mut`]: https://doc.rust-lang.org/beta/std/array/fn.from_mut.html
[`array::from_ref`]: https://doc.rust-lang.org/beta/std/array/fn.from_ref.html
[`cmp::max_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by_key.html
[`cmp::max_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.max_by.html
[`cmp::min_by_key`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by_key.html
[`cmp::min_by`]: https://doc.rust-lang.org/beta/std/cmp/fn.min_by.html
[`f32::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
[`f64::is_subnormal`]: https://doc.rust-lang.org/std/primitive.f64.html#method.is_subnormal
[ietf6943]: https://datatracker.ietf.org/doc/html/rfc6943#section-3.1.1
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

also add note about rust 1.53 or newer to README.md and bump ./rust-toolchain to 1.55 (latest release)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)

moron
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

also add note about rust 1.53 or newer to README.md and bump ./rust-toolchain to 1.55 (latest release)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

also add note about rust 1.53 or newer to README.md and bump ./rust-toolchain to 1.55 (latest release)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

also add note about rust 1.53 or newer to README.md and bump ./rust-toolchain to same (note: 1.55 is current release!)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

(and, I believe, is being used in the Linux daemon)
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Sep 10, 2021
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

bump to rust 1.53 (or newer is OK)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

I see similar syntax used in the Linux daemon, but that uses rust
1.41... I'm uncertain how that was building previously?

hurr
draeath added a commit to draeath/thelio-io-windows that referenced this pull request Apr 13, 2022
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

bump to rust 1.53 (or newer is OK)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

I see similar syntax used in the Linux daemon, but that uses rust
1.41... I'm uncertain how that was building previously?
jackpot51 pushed a commit to system76/thelio-io-windows that referenced this pull request Apr 13, 2022
fan curves and model strings current as-of:
  https://github.com/pop-os/system76-power/blob/79b02d/src/fan.rs

bump to rust 1.53 (or newer is OK)

This is due to the use of "or patterns" inside a match. This was
stabilized in rust 1.53: rust-lang/rust#79278

I see similar syntax used in the Linux daemon, but that uses rust
1.41... I'm uncertain how that was building previously?
dario23 added a commit to dario23/rust-semverver that referenced this pull request May 6, 2022
The corresponding feature has been stabilized in rust-lang/rust#79278,
merged 2021-03-22.
bors added a commit to rust-lang/rust-semverver that referenced this pull request May 7, 2022
Apply or-patterns clippy suggestion

The corresponding feature has been stabilized in rust-lang/rust#79278,
merged 2021-03-22.
bors bot added a commit to intellij-rust/intellij-rust that referenced this pull request Sep 2, 2022
9238: ANN: allow leading | in nested or patterns r=vlad20012 a=afetisov

<!--
Hello and thank you for the pull request!

We don't have any strict rules about pull requests, but you might check
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md
for some hints!

Also, please write a short description explaining your change in the following format: `changelog: %description%`
This description will help a lot to create release changelog. 
Drop these lines for internal only changes

:)
-->

Fixes #9001

Nested or-patterns were [stabilized](rust-lang/rust#79278) in Rust 1.53. The final design allows leading vertical bar `|` in nested or-patterns, just like toplevel or-patterns. This was previously an explicit error, also implemented in the plugin.

This PR reverts the deprecated error on nested patterns.

changelog: allow leading | in nested or-patterns

Co-authored-by: Anton Fetisov <[email protected]>
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. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for RFC 2535, 2530, 2175, "Or patterns, i.e Foo(Bar(x) | Baz(x))"