Skip to content

Commit d3e042d

Browse files
Rollup merge of #124749 - RossSmyth:stable_range, r=davidtwco
Stabilize exclusive_range_pattern (v2) This PR is identical to #124459, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F). r? ghost Original PR description: --- Stabilization report: #37854 (comment) FCP: #37854 (comment) Stabilization was blocked by a lint that was merged here: #118879 Documentation PR is here: rust-lang/reference#1484 `@rustbot` label +F-exclusive_range_pattern +T-lang
2 parents 3b8eba9 + 57f00ce commit d3e042d

File tree

84 files changed

+366
-691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+366
-691
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc_ast as ast;
22
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
33
use rustc_ast::{attr, AssocConstraint, AssocConstraintKind, NodeId};
4-
use rustc_ast::{token, PatKind, RangeEnd};
4+
use rustc_ast::{token, PatKind};
55
use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
66
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
77
use rustc_session::Session;
@@ -418,15 +418,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
418418
PatKind::Box(..) => {
419419
gate!(&self, box_patterns, pattern.span, "box pattern syntax is experimental");
420420
}
421-
PatKind::Range(_, Some(_), Spanned { node: RangeEnd::Excluded, .. }) => {
422-
gate!(
423-
&self,
424-
exclusive_range_pattern,
425-
pattern.span,
426-
"exclusive range pattern syntax is experimental",
427-
"use an inclusive range pattern, like N..=M"
428-
);
429-
}
430421
_ => {}
431422
}
432423
visit::walk_pat(self, pattern)
@@ -619,10 +610,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
619610
// be too.
620611
gate_all_legacy_dont_use!(return_type_notation, "return type notation is experimental");
621612
gate_all_legacy_dont_use!(decl_macro, "`macro` is experimental");
622-
gate_all_legacy_dont_use!(
623-
exclusive_range_pattern,
624-
"exclusive range pattern syntax is experimental"
625-
);
626613
gate_all_legacy_dont_use!(try_blocks, "`try` blocks are unstable");
627614
gate_all_legacy_dont_use!(auto_traits, "`auto` traits are unstable");
628615

compiler/rustc_error_codes/src/error_codes/E0579.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ A lower range wasn't less than the upper range.
33
Erroneous code example:
44

55
```compile_fail,E0579
6-
#![feature(exclusive_range_pattern)]
76
87
fn main() {
98
match 5u32 {

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ declare_features! (
162162
(accepted, drop_types_in_const, "1.22.0", Some(33156)),
163163
/// Allows using `dyn Trait` as a syntax for trait objects.
164164
(accepted, dyn_trait, "1.27.0", Some(44662)),
165+
/// Allows `X..Y` patterns.
166+
(accepted, exclusive_range_pattern, "CURRENT_RUSTC_VERSION", Some(37854)),
165167
/// Allows integer match exhaustiveness checking (RFC 2591).
166168
(accepted, exhaustive_integer_patterns, "1.33.0", Some(50907)),
167169
/// Allows explicit generic arguments specification with `impl Trait` present.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,6 @@ declare_features! (
454454
(incomplete, dyn_star, "1.65.0", Some(102425)),
455455
/// Uses generic effect parameters for ~const bounds
456456
(unstable, effects, "1.72.0", Some(102090)),
457-
/// Allows `X..Y` patterns.
458-
(unstable, exclusive_range_pattern, "1.11.0", Some(37854)),
459457
/// Allows exhaustive pattern matching on types that contain uninhabited types.
460458
(unstable, exhaustive_patterns, "1.13.0", Some(51085)),
461459
/// Allows explicit tail calls via `become` expression.

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ declare_lint! {
844844
/// ### Example
845845
///
846846
/// ```rust
847-
/// # #![feature(exclusive_range_pattern)]
848847
/// let x = 123u32;
849848
/// match x {
850849
/// 0..100 => { println!("small"); }

compiler/rustc_pattern_analysis/src/usefulness.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
//! This is enough to compute usefulness: a pattern in a `match` expression is redundant iff it is
4343
//! not useful w.r.t. the patterns above it:
4444
//! ```compile_fail,E0004
45-
//! # #![feature(exclusive_range_pattern)]
4645
//! # fn foo() {
4746
//! match Some(0u32) {
4847
//! Some(0..100) => {},

library/alloc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
//
166166
// Language features:
167167
// tidy-alphabetical-start
168+
#![cfg_attr(bootstrap, feature(exclusive_range_pattern))]
168169
#![cfg_attr(not(test), feature(coroutine_trait))]
169170
#![cfg_attr(test, feature(panic_update_hook))]
170171
#![cfg_attr(test, feature(test))]
@@ -179,7 +180,6 @@
179180
#![feature(const_try)]
180181
#![feature(decl_macro)]
181182
#![feature(dropck_eyepatch)]
182-
#![feature(exclusive_range_pattern)]
183183
#![feature(fundamental)]
184184
#![feature(hashmap_internals)]
185185
#![feature(lang_items)]

src/doc/unstable-book/src/language-features/exclusive-range-pattern.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/doc/unstable-book/src/language-features/half-open-range-patterns-in-slices.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# `half_open_range_patterns_in_slices`
22

33
The tracking issue for this feature is: [#67264]
4-
It is part of the `exclusive_range_pattern` feature,
4+
It is a future part of the `exclusive_range_pattern` feature,
55
tracked at [#37854].
66

77
[#67264]: https://github.com/rust-lang/rust/issues/67264
@@ -12,7 +12,6 @@ This feature allow using top-level half-open range patterns in slices.
1212

1313
```rust
1414
#![feature(half_open_range_patterns_in_slices)]
15-
#![feature(exclusive_range_pattern)]
1615

1716
fn main() {
1817
let xs = [13, 1, 5, 2, 3, 1, 21, 8];

src/tools/clippy/tests/ui/almost_complete_range.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@edition:2018
22
//@aux-build:proc_macros.rs
33

4-
#![feature(exclusive_range_pattern)]
54
#![feature(stmt_expr_attributes)]
65
#![warn(clippy::almost_complete_range)]
76
#![allow(ellipsis_inclusive_range_patterns)]

0 commit comments

Comments
 (0)