-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Stabilize half_open_range_patterns
#102275
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
Merged
bors
merged 2 commits into
rust-lang:master
from
Urgau:stabilize-half_open_range_patterns
Oct 10, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
30 changes: 30 additions & 0 deletions
30
src/doc/unstable-book/src/language-features/half-open-range-patterns-in-slices.md
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# `half_open_range_patterns_in_slices` | ||
|
||
The tracking issue for this feature is: [#67264] | ||
It is part of the `exclusive_range_pattern` feature, | ||
tracked at [#37854]. | ||
|
||
[#67264]: https://github.com/rust-lang/rust/issues/67264 | ||
[#37854]: https://github.com/rust-lang/rust/issues/37854 | ||
----- | ||
|
||
This feature allow using top-level half-open range patterns in slices. | ||
|
||
```rust | ||
#![feature(half_open_range_patterns_in_slices)] | ||
#![feature(exclusive_range_pattern)] | ||
|
||
fn main() { | ||
let xs = [13, 1, 5, 2, 3, 1, 21, 8]; | ||
let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs else { return; }; | ||
} | ||
``` | ||
|
||
Note that this feature is not required if the patterns are wrapped between parenthesis. | ||
|
||
```rust | ||
fn main() { | ||
let xs = [13, 1]; | ||
let [(a @ 3..), c] = xs else { return; }; | ||
} | ||
``` |
27 changes: 0 additions & 27 deletions
27
src/doc/unstable-book/src/language-features/half-open-range-patterns.md
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision.rs
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision2.rs
This file contains hidden or 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
1 change: 0 additions & 1 deletion
1
src/test/ui/half-open-range-patterns/exclusive_range_pattern_syntax_collision3.rs
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#![feature(half_open_range_patterns)] | ||
#![feature(exclusive_range_pattern)] | ||
|
||
fn main() { | ||
|
This file contains hidden or 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
7 changes: 7 additions & 0 deletions
7
src/test/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.rs
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#![feature(exclusive_range_pattern)] | ||
|
||
fn main() { | ||
let xs = [13, 1, 5, 2, 3, 1, 21, 8]; | ||
let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; | ||
//~^ `X..` patterns in slices are experimental | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0658]: `X..` patterns in slices are experimental | ||
--> $DIR/feature-gate-half-open-range-patterns-in-slices.rs:5:10 | ||
| | ||
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs; | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #67264 <https://github.com/rust-lang/rust/issues/67264> for more information | ||
= help: add `#![feature(half_open_range_patterns_in_slices)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
18 changes: 0 additions & 18 deletions
18
src/test/ui/half-open-range-patterns/feature-gate-half-open-range-patterns.rs
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
src/test/ui/half-open-range-patterns/feature-gate-half-open-range-patterns.stderr
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
src/test/ui/half-open-range-patterns/half-open-range-pats-bad-types.rs
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#![feature(half_open_range_patterns)] | ||
#![feature(exclusive_range_pattern)] | ||
|
||
fn main() { | ||
|
6 changes: 3 additions & 3 deletions
6
src/test/ui/half-open-range-patterns/half-open-range-pats-bad-types.stderr
This file contains hidden or 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
1 change: 0 additions & 1 deletion
1
src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.rs
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.