From db5629adcba565a674732e829ce6c4a214160835 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 21 Nov 2020 15:12:05 -0600 Subject: [PATCH 1/6] stabilize or_patterns --- compiler/rustc_apfloat/src/lib.rs | 2 +- compiler/rustc_ast/src/lib.rs | 2 +- compiler/rustc_ast_lowering/src/lib.rs | 2 +- compiler/rustc_ast_passes/src/feature_gate.rs | 1 - compiler/rustc_ast_pretty/src/lib.rs | 2 +- compiler/rustc_attr/src/lib.rs | 2 +- compiler/rustc_builtin_macros/src/lib.rs | 2 +- compiler/rustc_codegen_llvm/src/lib.rs | 2 +- compiler/rustc_codegen_ssa/src/lib.rs | 2 +- compiler/rustc_expand/src/expand.rs | 4 +- compiler/rustc_expand/src/lib.rs | 2 +- compiler/rustc_feature/src/accepted.rs | 2 + compiler/rustc_feature/src/active.rs | 3 - compiler/rustc_hir/src/lib.rs | 2 +- compiler/rustc_hir_pretty/src/lib.rs | 2 +- compiler/rustc_infer/src/lib.rs | 2 +- compiler/rustc_lint/src/lib.rs | 2 +- compiler/rustc_metadata/src/lib.rs | 2 +- compiler/rustc_middle/src/lib.rs | 2 +- compiler/rustc_mir/src/lib.rs | 2 +- compiler/rustc_mir_build/src/lib.rs | 2 +- compiler/rustc_parse/src/lib.rs | 2 +- compiler/rustc_parse/src/parser/expr.rs | 8 +- compiler/rustc_parse/src/parser/mod.rs | 2 +- .../rustc_parse/src/parser/nonterminal.rs | 4 +- compiler/rustc_parse/src/parser/pat.rs | 73 +++++-------------- compiler/rustc_parse/src/parser/stmt.rs | 5 +- compiler/rustc_parse_format/src/lib.rs | 2 +- compiler/rustc_passes/src/lib.rs | 2 +- compiler/rustc_privacy/src/lib.rs | 2 +- compiler/rustc_resolve/src/lib.rs | 2 +- compiler/rustc_save_analysis/src/lib.rs | 2 +- compiler/rustc_session/src/lib.rs | 2 +- compiler/rustc_symbol_mangling/src/lib.rs | 2 +- compiler/rustc_trait_selection/src/lib.rs | 2 +- compiler/rustc_typeck/src/lib.rs | 2 +- 36 files changed, 59 insertions(+), 97 deletions(-) diff --git a/compiler/rustc_apfloat/src/lib.rs b/compiler/rustc_apfloat/src/lib.rs index 4a845fcb6917b..c1aa74029f5eb 100644 --- a/compiler/rustc_apfloat/src/lib.rs +++ b/compiler/rustc_apfloat/src/lib.rs @@ -34,7 +34,7 @@ #![no_std] #![forbid(unsafe_code)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #[macro_use] extern crate alloc; diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index 03ec4b8a44da6..a823d375fcf50 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -16,7 +16,7 @@ #![feature(crate_visibility_modifier)] #![feature(label_break_value)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index f9872f84e125e..8a051066c7d21 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -31,7 +31,7 @@ //! in the HIR, especially for multiple identifiers. #![feature(crate_visibility_modifier)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(box_patterns)] #![recursion_limit = "256"] diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 0ca9c12f4c133..2f73e44faf62b 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -686,7 +686,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { "to use an async block, remove the `||`: `async {`" ); gate_all!(generators, "yield syntax is experimental"); - gate_all!(or_patterns, "or-patterns syntax is experimental"); gate_all!(raw_ref_op, "raw address of syntax is experimental"); gate_all!(const_trait_bound_opt_out, "`?const` on trait bounds is experimental"); gate_all!(const_trait_impl, "const trait impls are experimental"); diff --git a/compiler/rustc_ast_pretty/src/lib.rs b/compiler/rustc_ast_pretty/src/lib.rs index d869baad012ed..67b66284f66f0 100644 --- a/compiler/rustc_ast_pretty/src/lib.rs +++ b/compiler/rustc_ast_pretty/src/lib.rs @@ -1,6 +1,6 @@ #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(box_patterns)] #![recursion_limit = "256"] diff --git a/compiler/rustc_attr/src/lib.rs b/compiler/rustc_attr/src/lib.rs index 149a950f7d417..ab68d24e4b339 100644 --- a/compiler/rustc_attr/src/lib.rs +++ b/compiler/rustc_attr/src/lib.rs @@ -4,7 +4,7 @@ //! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax` //! to this crate. -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #[macro_use] extern crate rustc_macros; diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index a46a5502b24ad..fe4bede6a48b9 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -8,7 +8,7 @@ #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] #![recursion_limit = "256"] diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index d11c1592f99d1..2bfb68f49041a 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -11,7 +11,7 @@ #![feature(extern_types)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] use back::write::{create_informational_target_machine, create_target_machine}; diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index dd04d3e548f8c..6eead2812ba70 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -6,7 +6,7 @@ #![feature(try_blocks)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(associated_type_bounds)] #![recursion_limit = "256"] #![feature(box_syntax)] diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index 0992f59843114..2674ccced6f61 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -22,7 +22,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, PResult}; use rustc_feature::Features; -use rustc_parse::parser::{AttemptLocalParseRecovery, ForceCollect, GateOr, Parser, RecoverComma}; +use rustc_parse::parser::{AttemptLocalParseRecovery, ForceCollect, Parser, RecoverComma}; use rustc_parse::validate_attr; use rustc_session::lint::builtin::UNUSED_DOC_COMMENTS; use rustc_session::lint::BuiltinLintDiagnostics; @@ -917,7 +917,7 @@ pub fn parse_ast_fragment<'a>( } AstFragmentKind::Ty => AstFragment::Ty(this.parse_ty()?), AstFragmentKind::Pat => { - AstFragment::Pat(this.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No)?) + AstFragment::Pat(this.parse_pat_allow_top_alt(None, RecoverComma::No)?) } AstFragmentKind::Arms | AstFragmentKind::Fields diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 1a93975533de0..14f04dcb51a0b 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -2,7 +2,7 @@ #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(destructuring_assignment)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_internals)] #![feature(proc_macro_span)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 9902b6cc9e842..ce9f711b27e53 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -277,6 +277,8 @@ declare_features! ( (accepted, min_const_generics, "1.51.0", Some(74878), None), /// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block. (accepted, unsafe_block_in_unsafe_fn, "1.51.0", Some(71668), None), + /// Allows the use of or-patterns (e.g., `0 | 1`). + (accepted, or_patterns, "1.53.0", Some(54883), None), // ------------------------------------------------------------------------- // feature-group-end: accepted features diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 79ec9c264998c..f55ba22e7dd47 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -488,9 +488,6 @@ declare_features! ( /// Allows `impl Trait` to be used inside type aliases (RFC 2515). (active, type_alias_impl_trait, "1.38.0", Some(63063), None), - /// Allows the use of or-patterns (e.g., `0 | 1`). - (active, or_patterns, "1.38.0", Some(54883), None), - /// Allows the definition of `const extern fn` and `const unsafe extern fn`. (active, const_extern_fn, "1.40.0", Some(64926), None), diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 45bb911130960..36a30900fb26c 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -8,7 +8,7 @@ #![feature(extended_key_value_attributes)] #![feature(in_band_lifetimes)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index b37a3e19b8408..76e5d30dc5ee2 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] use rustc_ast as ast; diff --git a/compiler/rustc_infer/src/lib.rs b/compiler/rustc_infer/src/lib.rs index f9170ef5dc346..4ec229ebcf559 100644 --- a/compiler/rustc_infer/src/lib.rs +++ b/compiler/rustc_infer/src/lib.rs @@ -20,7 +20,7 @@ #![feature(const_panic)] #![feature(extend_one)] #![feature(never_type)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(in_band_lifetimes)] #![feature(control_flow_enum)] #![recursion_limit = "512"] // For rustdoc diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 4c3dbcabc88a6..cacdf26054825 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -35,7 +35,7 @@ #![feature(iter_order_by)] #![feature(never_type)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(half_open_range_patterns)] #![feature(exclusive_range_pattern)] #![feature(control_flow_enum)] diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 2560cfa74624a..fe93f4230e95b 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -5,7 +5,7 @@ #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(proc_macro_internals)] #![feature(min_specialization)] #![feature(stmt_expr_attributes)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 2d807591bfdd2..6af0b4947e8bc 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -39,7 +39,7 @@ #![feature(extern_types)] #![feature(nll)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(min_specialization)] #![feature(trusted_len)] #![feature(test)] diff --git a/compiler/rustc_mir/src/lib.rs b/compiler/rustc_mir/src/lib.rs index f73d5dc0c116d..3235464141237 100644 --- a/compiler/rustc_mir/src/lib.rs +++ b/compiler/rustc_mir/src/lib.rs @@ -27,7 +27,7 @@ Rust MIR: a lowered representation of Rust. #![feature(stmt_expr_attributes)] #![feature(trait_alias)] #![feature(option_get_or_insert_default)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(once_cell)] #![feature(control_flow_enum)] #![recursion_limit = "256"] diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index b1591d8ba35f4..9aca005ae9101 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -10,7 +10,7 @@ #![feature(crate_visibility_modifier)] #![feature(bool_to_option)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 001b52b56fc65..9fead30c4a178 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -3,7 +3,7 @@ #![feature(crate_visibility_modifier)] #![feature(bindings_after_at)] #![feature(iter_order_by)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(box_syntax)] #![feature(box_patterns)] #![recursion_limit = "256"] diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index a3f2a8b3c5708..d64e5173b926c 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1,4 +1,4 @@ -use super::pat::{GateOr, RecoverComma, PARAM_EXPECTED}; +use super::pat::{RecoverComma, PARAM_EXPECTED}; use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; use super::{AttrWrapper, BlockMode, ForceCollect, Parser, PathStyle, Restrictions, TokenType}; use super::{SemiColonMode, SeqSep, TokenExpectType, TrailingToken}; @@ -1803,7 +1803,7 @@ impl<'a> Parser<'a> { /// The `let` token has already been eaten. fn parse_let_expr(&mut self, attrs: AttrVec) -> PResult<'a, P> { let lo = self.prev_token.span; - let pat = self.parse_pat_allow_top_alt(None, GateOr::No, RecoverComma::Yes)?; + let pat = self.parse_pat_allow_top_alt(None, RecoverComma::Yes)?; self.expect(&token::Eq)?; let expr = self.with_res(self.restrictions | Restrictions::NO_STRUCT_LITERAL, |this| { this.parse_assoc_expr_with(1 + prec_let_scrutinee_needs_par(), None.into()) @@ -1866,7 +1866,7 @@ impl<'a> Parser<'a> { _ => None, }; - let pat = self.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::Yes)?; + let pat = self.parse_pat_allow_top_alt(None, RecoverComma::Yes)?; if !self.eat_keyword(kw::In) { self.error_missing_in_for_loop(); } @@ -2073,7 +2073,7 @@ impl<'a> Parser<'a> { let attrs = self.parse_outer_attributes()?; self.collect_tokens_trailing_token(attrs, ForceCollect::No, |this, attrs| { let lo = this.token.span; - let pat = this.parse_pat_allow_top_alt(None, GateOr::No, RecoverComma::Yes)?; + let pat = this.parse_pat_allow_top_alt(None, RecoverComma::Yes)?; let guard = if this.eat_keyword(kw::If) { let if_span = this.prev_token.span; let cond = this.parse_expr()?; diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 4cc2224d27e42..71103840f1396 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -14,7 +14,7 @@ use crate::lexer::UnmatchedBrace; pub use attr_wrapper::AttrWrapper; pub use diagnostics::AttemptLocalParseRecovery; use diagnostics::Error; -pub use pat::{GateOr, RecoverComma}; +pub use pat::RecoverComma; pub use path::PathStyle; use rustc_ast::ptr::P; diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index a84ae5151442d..464524e3c061f 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -4,7 +4,7 @@ use rustc_ast_pretty::pprust; use rustc_errors::PResult; use rustc_span::symbol::{kw, Ident}; -use crate::parser::pat::{GateOr, RecoverComma}; +use crate::parser::pat::RecoverComma; use crate::parser::{FollowedByType, ForceCollect, Parser, PathStyle}; impl<'a> Parser<'a> { @@ -122,7 +122,7 @@ impl<'a> Parser<'a> { token::NtPat(self.collect_tokens_no_attrs(|this| match kind { NonterminalKind::Pat2018 { .. } => this.parse_pat_no_top_alt(None), NonterminalKind::Pat2021 { .. } => { - this.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No) + this.parse_pat_allow_top_alt(None, RecoverComma::No) } _ => unreachable!(), })?) diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 51c01f5a775a1..0abefbd6a1219 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -17,13 +17,6 @@ pub(super) const PARAM_EXPECTED: Expected = Some("parameter name"); const WHILE_PARSING_OR_MSG: &str = "while parsing this or-pattern starting here"; -/// Whether or not an or-pattern should be gated when occurring in the current context. -#[derive(PartialEq, Clone, Copy)] -pub enum GateOr { - Yes, - No, -} - /// Whether or not to recover a `,` when parsing or-patterns. #[derive(PartialEq, Copy, Clone)] pub enum RecoverComma { @@ -64,10 +57,9 @@ impl<'a> Parser<'a> { pub fn parse_pat_allow_top_alt( &mut self, expected: Expected, - gate_or: GateOr, rc: RecoverComma, ) -> PResult<'a, P> { - self.parse_pat_allow_top_alt_inner(expected, gate_or, rc).map(|(pat, _)| pat) + self.parse_pat_allow_top_alt_inner(expected, rc).map(|(pat, _)| pat) } /// Returns the pattern and a bool indicating whether we recovered from a trailing vert (true = @@ -75,7 +67,6 @@ impl<'a> Parser<'a> { fn parse_pat_allow_top_alt_inner( &mut self, expected: Expected, - gate_or: GateOr, rc: RecoverComma, ) -> PResult<'a, (P, bool)> { // Keep track of whether we recovered from a trailing vert so that we can avoid duplicated @@ -90,7 +81,7 @@ impl<'a> Parser<'a> { // Parse the first pattern (`p_0`). let first_pat = self.parse_pat_no_top_alt(expected)?; - self.maybe_recover_unexpected_comma(first_pat.span, rc, gate_or)?; + self.maybe_recover_unexpected_comma(first_pat.span, rc)?; // If the next token is not a `|`, // this is not an or-pattern and we should exit here. @@ -99,10 +90,6 @@ impl<'a> Parser<'a> { // then we should really gate the leading `|`. // This complicated procedure is done purely for diagnostics UX. if let Some(leading_vert_span) = leading_vert_span { - if gate_or == GateOr::Yes && self.sess.gated_spans.is_ungated(sym::or_patterns) { - self.sess.gated_spans.gate(sym::or_patterns, leading_vert_span); - } - // If there was a leading vert, treat this as an or-pattern. This improves // diagnostics. let span = leading_vert_span.to(self.prev_token.span); @@ -128,16 +115,11 @@ impl<'a> Parser<'a> { err.span_label(lo, WHILE_PARSING_OR_MSG); err })?; - self.maybe_recover_unexpected_comma(pat.span, rc, gate_or)?; + self.maybe_recover_unexpected_comma(pat.span, rc)?; pats.push(pat); } let or_pattern_span = lo.to(self.prev_token.span); - // Feature gate the or-pattern if instructed: - if gate_or == GateOr::Yes { - self.sess.gated_spans.gate(sym::or_patterns, or_pattern_span); - } - Ok((self.mk_pat(or_pattern_span, PatKind::Or(pats)), trailing_vert)) } @@ -152,14 +134,13 @@ impl<'a> Parser<'a> { pub(super) fn parse_pat_before_ty( &mut self, expected: Expected, - gate_or: GateOr, rc: RecoverComma, syntax_loc: &str, ) -> PResult<'a, (P, bool)> { // We use `parse_pat_allow_top_alt` regardless of whether we actually want top-level // or-patterns so that we can detect when a user tries to use it. This allows us to print a // better error message. - let (pat, trailing_vert) = self.parse_pat_allow_top_alt_inner(expected, gate_or, rc)?; + let (pat, trailing_vert) = self.parse_pat_allow_top_alt_inner(expected, rc)?; let colon = self.eat(&token::Colon); if let PatKind::Or(pats) = &pat.kind { @@ -213,12 +194,7 @@ impl<'a> Parser<'a> { self.bump(); } - self.parse_pat_before_ty( - PARAM_EXPECTED, - GateOr::No, - RecoverComma::No, - "function parameters", - ) + self.parse_pat_before_ty(PARAM_EXPECTED, RecoverComma::No, "function parameters") } /// Eat the or-pattern `|` separator. @@ -287,12 +263,7 @@ impl<'a> Parser<'a> { /// Some special error handling for the "top-level" patterns in a match arm, /// `for` loop, `let`, &c. (in contrast to subpatterns within such). - fn maybe_recover_unexpected_comma( - &mut self, - lo: Span, - rc: RecoverComma, - gate_or: GateOr, - ) -> PResult<'a, ()> { + fn maybe_recover_unexpected_comma(&mut self, lo: Span, rc: RecoverComma) -> PResult<'a, ()> { if rc == RecoverComma::No || self.token != token::Comma { return Ok(()); } @@ -313,22 +284,18 @@ impl<'a> Parser<'a> { if let Ok(seq_snippet) = self.span_to_snippet(seq_span) { const MSG: &str = "try adding parentheses to match on a tuple..."; - let or_suggestion = - gate_or == GateOr::No || !self.sess.gated_spans.is_ungated(sym::or_patterns); err.span_suggestion( seq_span, - if or_suggestion { MSG } else { MSG.trim_end_matches('.') }, + MSG, format!("({})", seq_snippet), Applicability::MachineApplicable, ); - if or_suggestion { - err.span_suggestion( - seq_span, - "...or a vertical bar to match on multiple alternatives", - seq_snippet.replace(",", " |"), - Applicability::MachineApplicable, - ); - } + err.span_suggestion( + seq_span, + "...or a vertical bar to match on multiple alternatives", + seq_snippet.replace(",", " |"), + Applicability::MachineApplicable, + ); } Err(err) } @@ -383,7 +350,7 @@ impl<'a> Parser<'a> { } else if self.check(&token::OpenDelim(token::Bracket)) { // Parse `[pat, pat,...]` as a slice pattern. let (pats, _) = self.parse_delim_comma_seq(token::Bracket, |p| { - p.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No) + p.parse_pat_allow_top_alt(None, RecoverComma::No) })?; PatKind::Slice(pats) } else if self.check(&token::DotDot) && !self.is_pat_range_end_start(1) { @@ -596,9 +563,8 @@ impl<'a> Parser<'a> { /// Parse a tuple or parenthesis pattern. fn parse_pat_tuple_or_parens(&mut self) -> PResult<'a, PatKind> { - let (fields, trailing_comma) = self.parse_paren_comma_seq(|p| { - p.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No) - })?; + let (fields, trailing_comma) = + self.parse_paren_comma_seq(|p| p.parse_pat_allow_top_alt(None, RecoverComma::No))?; // Here, `(pat,)` is a tuple pattern. // For backward compatibility, `(..)` is a tuple pattern as well. @@ -911,9 +877,8 @@ impl<'a> Parser<'a> { if qself.is_some() { return self.error_qpath_before_pat(&path, "("); } - let (fields, _) = self.parse_paren_comma_seq(|p| { - p.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No) - })?; + let (fields, _) = + self.parse_paren_comma_seq(|p| p.parse_pat_allow_top_alt(None, RecoverComma::No))?; Ok(PatKind::TupleStruct(path, fields)) } @@ -1079,7 +1044,7 @@ impl<'a> Parser<'a> { // Parsing a pattern of the form `fieldname: pat`. let fieldname = self.parse_field_name()?; self.bump(); - let pat = self.parse_pat_allow_top_alt(None, GateOr::Yes, RecoverComma::No)?; + let pat = self.parse_pat_allow_top_alt(None, RecoverComma::No)?; hi = pat.span; (pat, fieldname, false) } else { diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 92e67e7929180..24fb4301cc2b8 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -1,7 +1,7 @@ use super::attr::DEFAULT_INNER_ATTR_FORBIDDEN; use super::diagnostics::{AttemptLocalParseRecovery, Error}; use super::expr::LhsExpr; -use super::pat::{GateOr, RecoverComma}; +use super::pat::RecoverComma; use super::path::PathStyle; use super::TrailingToken; use super::{AttrWrapper, BlockMode, ForceCollect, Parser, Restrictions, SemiColonMode}; @@ -221,8 +221,7 @@ impl<'a> Parser<'a> { /// Parses a local variable declaration. fn parse_local(&mut self, attrs: AttrVec) -> PResult<'a, P> { let lo = self.prev_token.span; - let (pat, colon) = - self.parse_pat_before_ty(None, GateOr::Yes, RecoverComma::Yes, "`let` bindings")?; + let (pat, colon) = self.parse_pat_before_ty(None, RecoverComma::Yes, "`let` bindings")?; let (err, ty) = if colon { // Save the state of the parser before parsing type normally, in case there is a `:` diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs index 92d974690b514..c2fc2bfcd3353 100644 --- a/compiler/rustc_parse_format/src/lib.rs +++ b/compiler/rustc_parse_format/src/lib.rs @@ -10,7 +10,7 @@ test(attr(deny(warnings))) )] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(bool_to_option)] pub use Alignment::*; diff --git a/compiler/rustc_passes/src/lib.rs b/compiler/rustc_passes/src/lib.rs index 9759a500e0619..7ad6bd2bb3667 100644 --- a/compiler/rustc_passes/src/lib.rs +++ b/compiler/rustc_passes/src/lib.rs @@ -10,7 +10,7 @@ #![feature(crate_visibility_modifier)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 84240f86b53e2..de264b5bb0403 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1,7 +1,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(control_flow_enum)] #![feature(try_blocks)] #![feature(associated_type_defaults)] diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index ccfb5ff3aa0e6..d8f201fd0d8fa 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -15,7 +15,7 @@ #![feature(crate_visibility_modifier)] #![feature(format_args_capture)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] pub use rustc_hir::def::{Namespace, PerNS}; diff --git a/compiler/rustc_save_analysis/src/lib.rs b/compiler/rustc_save_analysis/src/lib.rs index 2acae29cc2542..13d613132c09d 100644 --- a/compiler/rustc_save_analysis/src/lib.rs +++ b/compiler/rustc_save_analysis/src/lib.rs @@ -1,6 +1,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] mod dump_visitor; diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index 7eaeae504ebf8..95d17125a11a9 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -1,6 +1,6 @@ #![feature(crate_visibility_modifier)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![recursion_limit = "256"] #[macro_use] diff --git a/compiler/rustc_symbol_mangling/src/lib.rs b/compiler/rustc_symbol_mangling/src/lib.rs index 7f8cded0ac0ec..3dd7ce93deb98 100644 --- a/compiler/rustc_symbol_mangling/src/lib.rs +++ b/compiler/rustc_symbol_mangling/src/lib.rs @@ -90,7 +90,7 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(never_type)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(in_band_lifetimes)] #![recursion_limit = "256"] diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index aea3d8eef65d0..aeb7b149786e4 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -17,7 +17,7 @@ #![feature(in_band_lifetimes)] #![feature(never_type)] #![feature(crate_visibility_modifier)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(control_flow_enum)] #![recursion_limit = "512"] // For rustdoc diff --git a/compiler/rustc_typeck/src/lib.rs b/compiler/rustc_typeck/src/lib.rs index 88b47bf5b9cdd..c270a2368110a 100644 --- a/compiler/rustc_typeck/src/lib.rs +++ b/compiler/rustc_typeck/src/lib.rs @@ -64,7 +64,7 @@ This API is completely unstable and subject to change. #![feature(in_band_lifetimes)] #![feature(is_sorted)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(try_blocks)] #![feature(never_type)] #![feature(slice_partition_dedup)] From 553ceb0791ae95f6d6af4300f1d626ea104178e7 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 21 Nov 2020 15:18:04 -0600 Subject: [PATCH 2/6] core/std/alloc: stabilize or_patterns --- library/alloc/src/lib.rs | 2 +- library/core/src/lib.rs | 2 +- library/std/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index bde75031f6190..f34d25e01fc2f 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -118,7 +118,7 @@ #![feature(nonnull_slice_from_raw_parts)] #![feature(auto_traits)] #![feature(option_result_unwrap_unchecked)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(pattern)] #![feature(ptr_internals)] #![feature(rustc_attrs)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 8e35adcbd9ef5..f47ad7e6bc214 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -126,7 +126,7 @@ #![feature(exhaustive_patterns)] #![feature(no_core)] #![feature(auto_traits)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(prelude_import)] #![cfg_attr(not(bootstrap), feature(ptr_metadata))] #![feature(repr_simd, platform_intrinsics)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 8149858e10338..8b34fb0505517 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -297,7 +297,7 @@ #![feature(nonnull_slice_from_raw_parts)] #![feature(once_cell)] #![feature(auto_traits)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(panic_info_message)] #![feature(panic_internals)] #![feature(panic_unwind)] From 5cb8f92791432634a172740d8aca2ceae12c3e58 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 21 Nov 2020 15:22:32 -0600 Subject: [PATCH 3/6] clippy: stabilize or_patterns lint --- src/tools/clippy/clippy_lints/src/lib.rs | 2 +- .../clippy_lints/src/unnested_or_patterns.rs | 5 --- src/tools/clippy/clippy_utils/src/lib.rs | 2 +- .../tests/ui/unnested_or_patterns.fixed | 1 - .../clippy/tests/ui/unnested_or_patterns.rs | 1 - .../tests/ui/unnested_or_patterns.stderr | 32 +++++++++---------- .../tests/ui/unnested_or_patterns2.fixed | 1 - .../clippy/tests/ui/unnested_or_patterns2.rs | 1 - .../tests/ui/unnested_or_patterns2.stderr | 16 +++++----- .../clippy/tests/ui/unnested_or_patterns3.rs | 6 ---- .../tests/ui/while_let_on_iterator.fixed | 1 - .../clippy/tests/ui/while_let_on_iterator.rs | 1 - .../tests/ui/while_let_on_iterator.stderr | 14 ++++---- 13 files changed, 33 insertions(+), 50 deletions(-) delete mode 100644 src/tools/clippy/tests/ui/unnested_or_patterns3.rs diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 04e151df8e854..b4c450bda5c72 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -5,7 +5,7 @@ #![feature(drain_filter)] #![feature(in_band_lifetimes)] #![feature(once_cell)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(rustc_private)] #![feature(stmt_expr_attributes)] #![feature(control_flow_enum)] diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs index fa613bb7da300..5826e9a4aa5b3 100644 --- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs @@ -72,11 +72,6 @@ impl EarlyLintPass for UnnestedOrPatterns { } fn lint_unnested_or_patterns(cx: &EarlyContext<'_>, pat: &Pat) { - if !cx.sess.features_untracked().or_patterns { - // Do not suggest nesting the patterns if the feature `or_patterns` is not enabled. - return; - } - if let Ident(.., None) | Lit(_) | Wild | Path(..) | Range(..) | Rest | MacCall(_) = pat.kind { // This is a leaf pattern, so cloning is unprofitable. return; diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index d81b89dd001ce..7d3584333af6e 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1,6 +1,6 @@ #![feature(box_patterns)] #![feature(in_band_lifetimes)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(rustc_private)] #![recursion_limit = "512"] #![allow(clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate)] diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns.fixed b/src/tools/clippy/tests/ui/unnested_or_patterns.fixed index 13a036cd800bc..46463a29e9b20 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns.fixed +++ b/src/tools/clippy/tests/ui/unnested_or_patterns.fixed @@ -1,6 +1,5 @@ // run-rustfix -#![feature(or_patterns)] #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] #![allow(clippy::cognitive_complexity, clippy::match_ref_pats, clippy::upper_case_acronyms)] diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns.rs b/src/tools/clippy/tests/ui/unnested_or_patterns.rs index 4a10cc702c401..8ce0738bfc27b 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns.rs +++ b/src/tools/clippy/tests/ui/unnested_or_patterns.rs @@ -1,6 +1,5 @@ // run-rustfix -#![feature(or_patterns)] #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] #![allow(clippy::cognitive_complexity, clippy::match_ref_pats, clippy::upper_case_acronyms)] diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr index 1899dc657dfee..f7cb513c15c90 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr +++ b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr @@ -1,5 +1,5 @@ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:10:12 + --> $DIR/unnested_or_patterns.rs:9:12 | LL | if let box 0 | box 2 = Box::new(0) {} | ^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | if let box (0 | 2) = Box::new(0) {} | ^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:11:12 + --> $DIR/unnested_or_patterns.rs:10:12 | LL | if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:13:12 + --> $DIR/unnested_or_patterns.rs:12:12 | LL | if let &0 | C0 | &2 = &0 {} | ^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | if let &(0 | 2) | C0 = &0 {} | ^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:14:12 + --> $DIR/unnested_or_patterns.rs:13:12 | LL | if let &mut 0 | &mut 2 = &mut 0 {} | ^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | if let &mut (0 | 2) = &mut 0 {} | ^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:15:12 + --> $DIR/unnested_or_patterns.rs:14:12 | LL | if let x @ 0 | x @ 2 = 0 {} | ^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | if let x @ (0 | 2) = 0 {} | ^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:16:12 + --> $DIR/unnested_or_patterns.rs:15:12 | LL | if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -66,7 +66,7 @@ LL | if let (0, 1 | 2 | 3) = (0, 0) {} | ^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:17:12 + --> $DIR/unnested_or_patterns.rs:16:12 | LL | if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | if let (1 | 2 | 3, 0) = (0, 0) {} | ^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:18:12 + --> $DIR/unnested_or_patterns.rs:17:12 | LL | if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -88,7 +88,7 @@ LL | if let (x, ..) | (x, 1 | 2) = (0, 1) {} | ^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:19:12 + --> $DIR/unnested_or_patterns.rs:18:12 | LL | if let [0] | [1] = [0] {} | ^^^^^^^^^ @@ -99,7 +99,7 @@ LL | if let [0 | 1] = [0] {} | ^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:20:12 + --> $DIR/unnested_or_patterns.rs:19:12 | LL | if let [x, 0] | [x, 1] = [0, 1] {} | ^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL | if let [x, 0 | 1] = [0, 1] {} | ^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:21:12 + --> $DIR/unnested_or_patterns.rs:20:12 | LL | if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | if let [x, 0 | 1 | 2] = [0, 1] {} | ^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:22:12 + --> $DIR/unnested_or_patterns.rs:21:12 | LL | if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -132,7 +132,7 @@ LL | if let [x, ..] | [x, 1 | 2] = [0, 1] {} | ^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:24:12 + --> $DIR/unnested_or_patterns.rs:23:12 | LL | if let TS(0, x) | TS(1, x) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | if let TS(0 | 1, x) = TS(0, 0) {} | ^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:25:12 + --> $DIR/unnested_or_patterns.rs:24:12 | LL | if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,7 +154,7 @@ LL | if let TS(1 | 2 | 3, 0) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:26:12 + --> $DIR/unnested_or_patterns.rs:25:12 | LL | if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -165,7 +165,7 @@ LL | if let TS(x, ..) | TS(x, 1 | 2) = TS(0, 0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns.rs:31:12 + --> $DIR/unnested_or_patterns.rs:30:12 | LL | if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns2.fixed b/src/tools/clippy/tests/ui/unnested_or_patterns2.fixed index 02a129c55a3f5..d3539d798157b 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns2.fixed +++ b/src/tools/clippy/tests/ui/unnested_or_patterns2.fixed @@ -1,6 +1,5 @@ // run-rustfix -#![feature(or_patterns)] #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] #![allow(clippy::cognitive_complexity, clippy::match_ref_pats)] diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns2.rs b/src/tools/clippy/tests/ui/unnested_or_patterns2.rs index acf3158989dcc..9cea5cdea6997 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns2.rs +++ b/src/tools/clippy/tests/ui/unnested_or_patterns2.rs @@ -1,6 +1,5 @@ // run-rustfix -#![feature(or_patterns)] #![feature(box_patterns)] #![warn(clippy::unnested_or_patterns)] #![allow(clippy::cognitive_complexity, clippy::match_ref_pats)] diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr index 1847fd8e098c7..9042c9c00b1ac 100644 --- a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr +++ b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr @@ -1,5 +1,5 @@ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:10:12 + --> $DIR/unnested_or_patterns2.rs:9:12 | LL | if let Some(Some(0)) | Some(Some(1)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | if let Some(Some(0 | 1)) = None {} | ^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:11:12 + --> $DIR/unnested_or_patterns2.rs:10:12 | LL | if let Some(Some(0)) | Some(Some(1) | Some(2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -22,7 +22,7 @@ LL | if let Some(Some(0 | 1 | 2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:12:12 + --> $DIR/unnested_or_patterns2.rs:11:12 | LL | if let Some(Some(0 | 1) | Some(2)) | Some(Some(3) | Some(4)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,7 +33,7 @@ LL | if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:13:12 + --> $DIR/unnested_or_patterns2.rs:12:12 | LL | if let Some(Some(0) | Some(1 | 2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | if let Some(Some(0 | 1 | 2)) = None {} | ^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:14:12 + --> $DIR/unnested_or_patterns2.rs:13:12 | LL | if let ((0,),) | ((1,) | (2,),) = ((0,),) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | if let ((0 | 1 | 2,),) = ((0,),) {} | ^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:15:12 + --> $DIR/unnested_or_patterns2.rs:14:12 | LL | if let 0 | (1 | 2) = 0 {} | ^^^^^^^^^^^ @@ -66,7 +66,7 @@ LL | if let 0 | 1 | 2 = 0 {} | ^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:16:12 + --> $DIR/unnested_or_patterns2.rs:15:12 | LL | if let box (0 | 1) | (box 2 | box (3 | 4)) = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: unnested or-patterns - --> $DIR/unnested_or_patterns2.rs:17:12 + --> $DIR/unnested_or_patterns2.rs:16:12 | LL | if let box box 0 | box (box 2 | box 4) = Box::new(Box::new(0)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns3.rs b/src/tools/clippy/tests/ui/unnested_or_patterns3.rs deleted file mode 100644 index 6bd35057bfad1..0000000000000 --- a/src/tools/clippy/tests/ui/unnested_or_patterns3.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![warn(clippy::unnested_or_patterns)] - -// Test that `unnested_or_patterns` does not trigger without enabling `or_patterns` -fn main() { - if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {} -} diff --git a/src/tools/clippy/tests/ui/while_let_on_iterator.fixed b/src/tools/clippy/tests/ui/while_let_on_iterator.fixed index e99c98ac79f2a..749393db124b6 100644 --- a/src/tools/clippy/tests/ui/while_let_on_iterator.fixed +++ b/src/tools/clippy/tests/ui/while_let_on_iterator.fixed @@ -2,7 +2,6 @@ #![warn(clippy::while_let_on_iterator)] #![allow(clippy::never_loop, unreachable_code, unused_mut)] -#![feature(or_patterns)] fn base() { let mut iter = 1..20; diff --git a/src/tools/clippy/tests/ui/while_let_on_iterator.rs b/src/tools/clippy/tests/ui/while_let_on_iterator.rs index ba13172428e13..30e3b82a7ccdd 100644 --- a/src/tools/clippy/tests/ui/while_let_on_iterator.rs +++ b/src/tools/clippy/tests/ui/while_let_on_iterator.rs @@ -2,7 +2,6 @@ #![warn(clippy::while_let_on_iterator)] #![allow(clippy::never_loop, unreachable_code, unused_mut)] -#![feature(or_patterns)] fn base() { let mut iter = 1..20; diff --git a/src/tools/clippy/tests/ui/while_let_on_iterator.stderr b/src/tools/clippy/tests/ui/while_let_on_iterator.stderr index aa980d9965c76..6554977c798bc 100644 --- a/src/tools/clippy/tests/ui/while_let_on_iterator.stderr +++ b/src/tools/clippy/tests/ui/while_let_on_iterator.stderr @@ -1,5 +1,5 @@ error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:9:5 + --> $DIR/while_let_on_iterator.rs:8:5 | LL | while let Option::Some(x) = iter.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` @@ -7,37 +7,37 @@ LL | while let Option::Some(x) = iter.next() { = note: `-D clippy::while-let-on-iterator` implied by `-D warnings` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:14:5 + --> $DIR/while_let_on_iterator.rs:13:5 | LL | while let Some(x) = iter.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x in iter` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:19:5 + --> $DIR/while_let_on_iterator.rs:18:5 | LL | while let Some(_) = iter.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:102:9 + --> $DIR/while_let_on_iterator.rs:101:9 | LL | while let Some([..]) = it.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [..] in it` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:109:9 + --> $DIR/while_let_on_iterator.rs:108:9 | LL | while let Some([_x]) = it.next() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for [_x] in it` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:122:9 + --> $DIR/while_let_on_iterator.rs:121:9 | LL | while let Some(x @ [_]) = it.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for x @ [_] in it` error: this loop could be written as a `for` loop - --> $DIR/while_let_on_iterator.rs:154:9 + --> $DIR/while_let_on_iterator.rs:153:9 | LL | while let Some(_) = y.next() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in y` From 1f38c472c26ab07001193c3983f9cee0feba8e50 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 21 Nov 2020 15:53:33 -0600 Subject: [PATCH 4/6] remove unstable book chapter --- .../src/language-features/or-patterns.md | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 src/doc/unstable-book/src/language-features/or-patterns.md diff --git a/src/doc/unstable-book/src/language-features/or-patterns.md b/src/doc/unstable-book/src/language-features/or-patterns.md deleted file mode 100644 index 55c31add26d77..0000000000000 --- a/src/doc/unstable-book/src/language-features/or-patterns.md +++ /dev/null @@ -1,36 +0,0 @@ -# `or_patterns` - -The tracking issue for this feature is: [#54883] - -[#54883]: https://github.com/rust-lang/rust/issues/54883 - ------------------------- - -The `or_pattern` language feature allows `|` to be arbitrarily nested within -a pattern, for example, `Some(A(0) | B(1 | 2))` becomes a valid pattern. - -## Examples - -```rust,no_run -#![feature(or_patterns)] - -pub enum Foo { - Bar, - Baz, - Quux, -} - -pub fn example(maybe_foo: Option) { - match maybe_foo { - Some(Foo::Bar | Foo::Baz) => { - println!("The value contained `Bar` or `Baz`"); - } - Some(_) => { - println!("The value did not contain `Bar` or `Baz`"); - } - None => { - println!("The value was `None`"); - } - } -} -``` From fd516af66dff90682ed192cab330ceefffea8b29 Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 22 Nov 2020 14:02:19 -0600 Subject: [PATCH 5/6] librustdoc: or_patterns are stable --- src/librustdoc/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9e8432454429f..dabc21e3a447c 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -8,7 +8,7 @@ #![feature(box_syntax)] #![feature(in_band_lifetimes)] #![feature(nll)] -#![feature(or_patterns)] +#![cfg_attr(bootstrap, feature(or_patterns))] #![feature(test)] #![feature(crate_visibility_modifier)] #![feature(never_type)] From b9ecba30bc45af1d5ebe6480ccfb69efc7496a25 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 21 Nov 2020 16:05:17 -0600 Subject: [PATCH 6/6] update tests --- src/test/mir-opt/exponential-or.rs | 2 - ....match_tuple.SimplifyCfg-initial.after.mir | 88 ++++----- src/test/mir-opt/issues/issue-75439.rs | 1 - ...e_75439.foo.MatchBranchSimplification.diff | 78 ++++---- ...or-patterns-slice-patterns-box-patterns.rs | 1 - ...atterns-slice-patterns-box-patterns.stderr | 34 ++-- src/test/ui/borrowck/or-patterns.rs | 2 - src/test/ui/borrowck/or-patterns.stderr | 24 +-- ...92-tuple-destructure-missing-parens.stderr | 33 +++- .../lint/issue-54538-unused-parens-lint.fixed | 1 - .../ui/lint/issue-54538-unused-parens-lint.rs | 1 - .../issue-54538-unused-parens-lint.stderr | 50 ++--- .../issue-67691-unused-field-in-or-pattern.rs | 1 - ...ue-67691-unused-field-in-or-pattern.stderr | 14 +- src/test/ui/macros/edition-macro-pats.rs | 1 - src/test/ui/match/issue-72680.rs | 2 - src/test/ui/or-patterns/already-bound-name.rs | 2 - .../ui/or-patterns/already-bound-name.stderr | 30 +-- src/test/ui/or-patterns/basic-switch.rs | 2 - src/test/ui/or-patterns/basic-switchint.rs | 2 - src/test/ui/or-patterns/bindings-runpass-1.rs | 2 - src/test/ui/or-patterns/bindings-runpass-2.rs | 2 - src/test/ui/or-patterns/box-patterns.rs | 1 - .../ui/or-patterns/consistent-bindings.rs | 2 - src/test/ui/or-patterns/const-fn.rs | 1 - .../exhaustiveness-non-exhaustive.rs | 1 - .../exhaustiveness-non-exhaustive.stderr | 6 +- .../ui/or-patterns/exhaustiveness-pass.rs | 1 - .../exhaustiveness-unreachable-pattern.rs | 1 - .../exhaustiveness-unreachable-pattern.stderr | 54 ++--- .../feature-gate-or_patterns-leading-for.rs | 8 - ...eature-gate-or_patterns-leading-for.stderr | 12 -- .../feature-gate-or_patterns-leading-let.rs | 9 - ...eature-gate-or_patterns-leading-let.stderr | 18 -- .../or-patterns/feature-gate-or_patterns.rs | 54 ----- .../feature-gate-or_patterns.stderr | 186 ------------------ .../ui/or-patterns/fn-param-wrap-parens.fixed | 1 - .../ui/or-patterns/fn-param-wrap-parens.rs | 1 - .../or-patterns/fn-param-wrap-parens.stderr | 2 +- src/test/ui/or-patterns/for-loop.rs | 2 - src/test/ui/or-patterns/if-let-while-let.rs | 2 - src/test/ui/or-patterns/inconsistent-modes.rs | 1 - .../ui/or-patterns/inconsistent-modes.stderr | 18 +- .../issue-67514-irrefutable-param.rs | 2 - .../issue-68785-irrefutable-param-with-at.rs | 2 - ...ve-been-expanded-earlier-non-exhaustive.rs | 2 - ...een-expanded-earlier-non-exhaustive.stderr | 4 +- ...69875-should-have-been-expanded-earlier.rs | 2 - ...ssue-70413-no-unreachable-pat-and-guard.rs | 1 - src/test/ui/or-patterns/let-pattern.rs | 2 - src/test/ui/or-patterns/macro-pat.rs | 2 - .../mismatched-bindings-async-fn.rs | 2 - .../mismatched-bindings-async-fn.stderr | 8 +- src/test/ui/or-patterns/missing-bindings.rs | 1 - .../ui/or-patterns/missing-bindings.stderr | 52 ++--- src/test/ui/or-patterns/mix-with-wild.rs | 1 - .../ui/or-patterns/multiple-pattern-typo.rs | 2 +- .../or-patterns-binding-type-mismatch.rs | 2 - .../or-patterns-binding-type-mismatch.stderr | 44 ++--- .../or-patterns-default-binding-modes.rs | 1 - .../or-patterns/or-patterns-syntactic-fail.rs | 2 - .../or-patterns-syntactic-fail.stderr | 10 +- .../or-patterns/or-patterns-syntactic-pass.rs | 2 - .../ui/or-patterns/remove-leading-vert.fixed | 1 - .../ui/or-patterns/remove-leading-vert.rs | 1 - .../ui/or-patterns/remove-leading-vert.stderr | 42 ++-- .../ui/or-patterns/search-via-bindings.rs | 2 - src/test/ui/or-patterns/slice-patterns.rs | 2 - src/test/ui/or-patterns/struct-like.rs | 2 - .../or-patterns-box-patterns.rs | 1 - .../or-patterns-slice-patterns.rs | 1 - .../pattern/bindings-after-at/or-patterns.rs | 1 - .../pat-at-same-name-both.rs | 1 - .../pat-at-same-name-both.stderr | 20 +- 74 files changed, 320 insertions(+), 652 deletions(-) delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.rs delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.stderr delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.rs delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.stderr delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns.rs delete mode 100644 src/test/ui/or-patterns/feature-gate-or_patterns.stderr diff --git a/src/test/mir-opt/exponential-or.rs b/src/test/mir-opt/exponential-or.rs index 1d6f7b818901f..0b8be8385dde4 100644 --- a/src/test/mir-opt/exponential-or.rs +++ b/src/test/mir-opt/exponential-or.rs @@ -1,7 +1,5 @@ // Test that simple or-patterns don't get expanded to exponentially large CFGs -#![feature(or_patterns)] - // EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir fn match_tuple(x: (u32, bool, Option, u32)) -> u32 { match x { diff --git a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir index 0db0f8349bb73..aa4f996c4b46a 100644 --- a/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir +++ b/src/test/mir-opt/exponential_or.match_tuple.SimplifyCfg-initial.after.mir @@ -1,83 +1,83 @@ // MIR for `match_tuple` after SimplifyCfg-initial fn match_tuple(_1: (u32, bool, Option, u32)) -> u32 { - debug x => _1; // in scope 0 at $DIR/exponential-or.rs:6:16: 6:17 - let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:6:53: 6:56 - let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:8:37: 8:48 - let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77 - let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77 - let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67 - let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67 - let _7: u32; // in scope 0 at $DIR/exponential-or.rs:8:10: 8:21 - let _8: u32; // in scope 0 at $DIR/exponential-or.rs:8:57: 8:78 - let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:8:83: 8:84 - let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:8:87: 8:88 + debug x => _1; // in scope 0 at $DIR/exponential-or.rs:4:16: 4:17 + let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:4:53: 4:56 + let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:6:37: 6:48 + let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77 + let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77 + let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67 + let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67 + let _7: u32; // in scope 0 at $DIR/exponential-or.rs:6:10: 6:21 + let _8: u32; // in scope 0 at $DIR/exponential-or.rs:6:57: 6:78 + let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:6:83: 6:84 + let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:6:87: 6:88 scope 1 { - debug y => _7; // in scope 1 at $DIR/exponential-or.rs:8:10: 8:21 - debug z => _8; // in scope 1 at $DIR/exponential-or.rs:8:57: 8:78 + debug y => _7; // in scope 1 at $DIR/exponential-or.rs:6:10: 6:21 + debug z => _8; // in scope 1 at $DIR/exponential-or.rs:6:57: 6:78 } bb0: { - FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:7:11: 7:12 - switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:15: 8:16 + FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:5:11: 5:12 + switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:15: 6:16 } bb1: { - _0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:9:14: 9:15 - goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6 + _0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:7:14: 7:15 + goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6 } bb2: { - _2 = discriminant((_1.2: std::option::Option)); // scope 0 at $DIR/exponential-or.rs:8:37: 8:48 - switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:37: 8:48 + _2 = discriminant((_1.2: std::option::Option)); // scope 0 at $DIR/exponential-or.rs:6:37: 6:48 + switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:37: 6:48 } bb3: { - switchInt((((_1.2: std::option::Option) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:42: 8:43 + switchInt((((_1.2: std::option::Option) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:42: 6:43 } bb4: { - _5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67 - switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67 + _5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67 + switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67 } bb5: { - _6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67 - switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67 + _6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67 + switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67 } bb6: { - _3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77 - switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77 + _3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77 + switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77 } bb7: { - _4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77 - switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77 + _4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77 + switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77 } bb8: { - falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:8:9: 8:79 + falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:6:9: 6:79 } bb9: { - StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21 - _7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21 - StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78 - _8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78 - StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:8:83: 8:84 - _9 = _7; // scope 1 at $DIR/exponential-or.rs:8:83: 8:84 - StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 - _10 = _8; // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 - _0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:8:83: 8:88 - StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 - StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88 - StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88 - StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88 - goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6 + StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21 + _7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21 + StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78 + _8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78 + StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:6:83: 6:84 + _9 = _7; // scope 1 at $DIR/exponential-or.rs:6:83: 6:84 + StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88 + _10 = _8; // scope 1 at $DIR/exponential-or.rs:6:87: 6:88 + _0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:6:83: 6:88 + StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88 + StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88 + StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88 + StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88 + goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6 } bb10: { - return; // scope 0 at $DIR/exponential-or.rs:11:2: 11:2 + return; // scope 0 at $DIR/exponential-or.rs:9:2: 9:2 } } diff --git a/src/test/mir-opt/issues/issue-75439.rs b/src/test/mir-opt/issues/issue-75439.rs index 44d6bc619d3bb..b914055813f64 100644 --- a/src/test/mir-opt/issues/issue-75439.rs +++ b/src/test/mir-opt/issues/issue-75439.rs @@ -1,7 +1,6 @@ // EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff #![feature(const_fn_transmute)] -#![feature(or_patterns)] use std::mem::transmute; diff --git a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff index 43422b36e1e52..d5edf16525235 100644 --- a/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/issues/issue_75439.foo.MatchBranchSimplification.diff @@ -2,17 +2,17 @@ + // MIR for `foo` after MatchBranchSimplification fn foo(_1: [u8; 16]) -> Option<[u8; 4]> { - debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:8:12: 8:17 - let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:8:32: 8:47 - let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:10:9: 10:15 - let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:10:47: 10:52 - let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:13:14: 13:38 - let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:13:33: 13:35 + debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:7:12: 7:17 + let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:7:32: 7:47 + let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:9:9: 9:15 + let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:9:47: 9:52 + let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:12:14: 12:38 + let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:12:33: 12:35 scope 1 { - debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:10:9: 10:15 - let _4: u32; // in scope 1 at $DIR/issue-75439.rs:12:27: 12:29 + debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:9:9: 9:15 + let _4: u32; // in scope 1 at $DIR/issue-75439.rs:11:27: 11:29 scope 3 { - debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:12:27: 12:29 + debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:11:27: 11:29 scope 4 { } } @@ -21,67 +21,67 @@ } bb0: { - StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:10:9: 10:15 - StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:10:47: 10:52 - _3 = _1; // scope 2 at $DIR/issue-75439.rs:10:47: 10:52 - _2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:10:37: 10:53 + StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:9:9: 9:15 + StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:9:47: 9:52 + _3 = _1; // scope 2 at $DIR/issue-75439.rs:9:47: 9:52 + _2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:9:37: 9:53 // mir::Constant - // + span: $DIR/issue-75439.rs:10:37: 10:46 + // + span: $DIR/issue-75439.rs:9:37: 9:46 // + literal: Const { ty: unsafe extern "rust-intrinsic" fn([u8; 16]) -> [u32; 4] {std::intrinsics::transmute::<[u8; 16], [u32; 4]>}, val: Value(Scalar()) } } bb1: { - StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:10:52: 10:53 - switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:13: 12:14 + StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:9:52: 9:53 + switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:13: 11:14 } bb2: { - switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:16: 12:17 + switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:16: 11:17 } bb3: { - switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:19: 12:20 + switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:19: 11:20 } bb4: { - discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:15:9: 15:13 - goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6 + discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:14:9: 14:13 + goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6 } bb5: { - StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:13:14: 13:38 - StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:13:33: 13:35 - _6 = _4; // scope 4 at $DIR/issue-75439.rs:13:33: 13:35 - _5 = transmute::(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:13:23: 13:36 + StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:12:14: 12:38 + StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:12:33: 12:35 + _6 = _4; // scope 4 at $DIR/issue-75439.rs:12:33: 12:35 + _5 = transmute::(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:12:23: 12:36 // mir::Constant - // + span: $DIR/issue-75439.rs:13:23: 13:32 + // + span: $DIR/issue-75439.rs:12:23: 12:32 // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {std::intrinsics::transmute::}, val: Value(Scalar()) } } bb6: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29 - goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6 + StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29 + _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29 + goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6 } bb7: { - StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29 - _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29 - goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6 + StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29 + _4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29 + goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6 } bb8: { - StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:13:35: 13:36 - ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39 - discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39 - StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:13:38: 13:39 - StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:14:5: 14:6 - goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6 + StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:12:35: 12:36 + ((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39 + discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39 + StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:12:38: 12:39 + StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:13:5: 13:6 + goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6 } bb9: { - StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:17:1: 17:2 - return; // scope 0 at $DIR/issue-75439.rs:17:2: 17:2 + StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:16:1: 16:2 + return; // scope 0 at $DIR/issue-75439.rs:16:2: 16:2 } } diff --git a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs index 97f96ab69295f..2839a65deaa4b 100644 --- a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs +++ b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs @@ -1,6 +1,5 @@ // Tests using a combination of pattern features has the expected borrow checking behavior #![feature(bindings_after_at)] -#![feature(or_patterns)] #![feature(box_patterns)] enum Test { diff --git a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr index 96e313b39ed1e..2204dcabc9e47 100644 --- a/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr +++ b/src/test/ui/borrowck/bindings-after-at-or-patterns-slice-patterns-box-patterns.stderr @@ -1,5 +1,5 @@ error: cannot borrow value as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:38:9 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:37:9 | LL | ref foo @ [.., ref mut bar] => (), | -------^^^^^^^^-----------^ @@ -8,7 +8,7 @@ LL | ref foo @ [.., ref mut bar] => (), | immutable borrow, by `foo`, occurs here error: cannot borrow value as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:122:9 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:121:9 | LL | ref foo @ Some(box ref mut s) => (), | -------^^^^^^^^^^^^---------^ @@ -17,7 +17,7 @@ LL | ref foo @ Some(box ref mut s) => (), | immutable borrow, by `foo`, occurs here error[E0382]: borrow of moved value: `x` - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:20:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:19:5 | LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) { | - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait @@ -29,7 +29,7 @@ LL | &x; | ^^ value borrowed here after move error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:30:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:29:5 | LL | ref mut foo @ [.., _] => Some(foo), | --------------------- mutable borrow occurs here @@ -41,7 +41,7 @@ LL | drop(r); | - mutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:52:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:51:5 | LL | [ref foo @ .., ref bar] => Some(foo), | ------------ immutable borrow occurs here @@ -53,7 +53,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:64:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:63:5 | LL | ref foo @ [.., ref bar] => Some(foo), | ----------------------- immutable borrow occurs here @@ -65,7 +65,7 @@ LL | drop(r); | - immutable borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:78:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:77:5 | LL | fn bindings_after_at_or_patterns_move(x: Option) { | - move occurs because `x` has type `Option`, which does not implement the `Copy` trait @@ -80,7 +80,7 @@ LL | &x; | ^^ value borrowed here after move error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:88:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:87:5 | LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo), | ------------------------------------- immutable borrow occurs here @@ -92,7 +92,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:100:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:99:5 | LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo), | ----------------------------------------- mutable borrow occurs here @@ -104,7 +104,7 @@ LL | drop(r); | - mutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:114:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:113:5 | LL | ref foo @ Some(box ref s) => Some(foo), | ------------------------- immutable borrow occurs here @@ -116,7 +116,7 @@ LL | drop(r); | - immutable borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:136:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:135:5 | LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option; 4]) { | - move occurs because `x` has type `[Option; 4]`, which does not implement the `Copy` trait @@ -131,7 +131,7 @@ LL | &x; | ^^ value borrowed here after move error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:146:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:145:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a), | ------------------------------------------------- immutable borrow occurs here @@ -143,7 +143,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:158:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:157:5 | LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b), | ---------- immutable borrow occurs here @@ -155,7 +155,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:172:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:171:5 | LL | [_, ref a @ Some(box ref b), ..] => Some(a), | ----------------------- immutable borrow occurs here @@ -167,7 +167,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:188:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:187:5 | LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | ------------------------------------------- immutable borrow occurs here @@ -179,7 +179,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:202:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:201:5 | LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | ----------------------------------------------- mutable borrow occurs here @@ -191,7 +191,7 @@ LL | drop(r); | - mutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:216:5 + --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:215:5 | LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), | ------------------------------------------------------------ immutable borrow occurs here diff --git a/src/test/ui/borrowck/or-patterns.rs b/src/test/ui/borrowck/or-patterns.rs index 5b31e2d76a05b..aeab3b92e9840 100644 --- a/src/test/ui/borrowck/or-patterns.rs +++ b/src/test/ui/borrowck/or-patterns.rs @@ -1,8 +1,6 @@ // Test that borrow check considers all choices in an or pattern, even the // unreachable ones. -#![feature(or_patterns)] - fn or_pattern_moves_all(x: ((String, String),)) { match x { ((y, _) | (_, y),) => (), diff --git a/src/test/ui/borrowck/or-patterns.stderr b/src/test/ui/borrowck/or-patterns.stderr index 9593b94537aea..dd5797c3f79cc 100644 --- a/src/test/ui/borrowck/or-patterns.stderr +++ b/src/test/ui/borrowck/or-patterns.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `x.0.0` - --> $DIR/or-patterns.rs:10:5 + --> $DIR/or-patterns.rs:8:5 | LL | ((y, _) | (_, y),) => (), | - value moved here @@ -10,7 +10,7 @@ LL | &x.0 .0; = note: move occurs because `x.0.0` has type `String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x.0.1` - --> $DIR/or-patterns.rs:12:5 + --> $DIR/or-patterns.rs:10:5 | LL | ((y, _) | (_, y),) => (), | - value moved here @@ -21,7 +21,7 @@ LL | &x.0 .1; = note: move occurs because `x.0.1` has type `String`, which does not implement the `Copy` trait error[E0502]: cannot borrow `x.0.0` as mutable because it is also borrowed as immutable - --> $DIR/or-patterns.rs:20:5 + --> $DIR/or-patterns.rs:18:5 | LL | ((ref y, _) | (_, ref y),) => y, | ----- immutable borrow occurs here @@ -33,7 +33,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x.0.1` as mutable because it is also borrowed as immutable - --> $DIR/or-patterns.rs:22:5 + --> $DIR/or-patterns.rs:20:5 | LL | ((ref y, _) | (_, ref y),) => y, | ----- immutable borrow occurs here @@ -45,7 +45,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x.0.0` as immutable because it is also borrowed as mutable - --> $DIR/or-patterns.rs:31:5 + --> $DIR/or-patterns.rs:29:5 | LL | ((ref mut y, _) | (_, ref mut y),) => y, | --------- mutable borrow occurs here @@ -57,7 +57,7 @@ LL | drop(r); | - mutable borrow later used here error[E0502]: cannot borrow `x.0.1` as immutable because it is also borrowed as mutable - --> $DIR/or-patterns.rs:33:5 + --> $DIR/or-patterns.rs:31:5 | LL | ((ref mut y, _) | (_, ref mut y),) => y, | --------- mutable borrow occurs here @@ -69,7 +69,7 @@ LL | drop(r); | - mutable borrow later used here error[E0382]: borrow of moved value: `x.0.0` - --> $DIR/or-patterns.rs:40:5 + --> $DIR/or-patterns.rs:38:5 | LL | let ((y, _) | (_, y),) = x; | - value moved here @@ -79,7 +79,7 @@ LL | &x.0 .0; = note: move occurs because `x.0.0` has type `String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x.0.1` - --> $DIR/or-patterns.rs:42:5 + --> $DIR/or-patterns.rs:40:5 | LL | let ((y, _) | (_, y),) = x; | - value moved here @@ -90,7 +90,7 @@ LL | &x.0 .1; = note: move occurs because `x.0.1` has type `String`, which does not implement the `Copy` trait error[E0502]: cannot borrow `x.0.0` as mutable because it is also borrowed as immutable - --> $DIR/or-patterns.rs:48:5 + --> $DIR/or-patterns.rs:46:5 | LL | let ((ref r, _) | (_, ref r),) = x; | ----- immutable borrow occurs here @@ -101,7 +101,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x.0.1` as mutable because it is also borrowed as immutable - --> $DIR/or-patterns.rs:50:5 + --> $DIR/or-patterns.rs:48:5 | LL | let ((ref r, _) | (_, ref r),) = x; | ----- immutable borrow occurs here @@ -113,7 +113,7 @@ LL | drop(r); | - immutable borrow later used here error[E0502]: cannot borrow `x.0.0` as immutable because it is also borrowed as mutable - --> $DIR/or-patterns.rs:57:5 + --> $DIR/or-patterns.rs:55:5 | LL | let ((ref mut r, _) | (_, ref mut r),) = x; | --------- mutable borrow occurs here @@ -124,7 +124,7 @@ LL | drop(r); | - mutable borrow later used here error[E0502]: cannot borrow `x.0.1` as immutable because it is also borrowed as mutable - --> $DIR/or-patterns.rs:59:5 + --> $DIR/or-patterns.rs:57:5 | LL | let ((ref mut r, _) | (_, ref mut r),) = x; | --------- mutable borrow occurs here diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index 26c24d7432c48..d05d6d120b084 100644 --- a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -47,19 +47,46 @@ error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10 | LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { - | -^----------- help: try adding parentheses to match on a tuple: `(x, _barr_body)` + | ^ + | +help: try adding parentheses to match on a tuple... + | +LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) { + | ^^^^^^^^^^^^^^^ +help: ...or a vertical bar to match on multiple alternatives + | +LL | for x | _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { + | ^^^^^^^^^^^^^^ error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:75:10 | LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { - | -^------------------- help: try adding parentheses to match on a tuple: `(x, y @ Allosome::Y(_))` + | ^ + | +help: try adding parentheses to match on a tuple... + | +LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) { + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: ...or a vertical bar to match on multiple alternatives + | +LL | for x | y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { + | ^^^^^^^^^^^^^^^^^^^^^^ error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:84:14 | LL | let women, men: (Vec, Vec) = genomes.iter().cloned() - | -----^---- help: try adding parentheses to match on a tuple: `(women, men)` + | ^ + | +help: try adding parentheses to match on a tuple... + | +LL | let (women, men): (Vec, Vec) = genomes.iter().cloned() + | ^^^^^^^^^^^^ +help: ...or a vertical bar to match on multiple alternatives + | +LL | let women | men: (Vec, Vec) = genomes.iter().cloned() + | ^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.fixed b/src/test/ui/lint/issue-54538-unused-parens-lint.fixed index c70c39b5f6dc7..0b3fe9371f775 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.fixed +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.fixed @@ -1,7 +1,6 @@ // run-rustfix #![feature(box_patterns, stmt_expr_attributes)] -#![feature(or_patterns)] #![allow( dead_code, diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.rs b/src/test/ui/lint/issue-54538-unused-parens-lint.rs index 9dd3b63c0fed7..1e78ec5f7d95d 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.rs +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.rs @@ -1,7 +1,6 @@ // run-rustfix #![feature(box_patterns, stmt_expr_attributes)] -#![feature(or_patterns)] #![allow( dead_code, diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr index ee466857757a3..e6d0a359c5ca7 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -1,149 +1,149 @@ error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:17:9 + --> $DIR/issue-54538-unused-parens-lint.rs:16:9 | LL | let (a) = 0; | ^^^ help: remove these parentheses | note: the lint level is defined here - --> $DIR/issue-54538-unused-parens-lint.rs:14:9 + --> $DIR/issue-54538-unused-parens-lint.rs:13:9 | LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:18:9 + --> $DIR/issue-54538-unused-parens-lint.rs:17:9 | LL | for (a) in 0..1 {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:19:12 + --> $DIR/issue-54538-unused-parens-lint.rs:18:12 | LL | if let (a) = 0 {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:20:15 + --> $DIR/issue-54538-unused-parens-lint.rs:19:15 | LL | while let (a) = 0 {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:21:12 + --> $DIR/issue-54538-unused-parens-lint.rs:20:12 | LL | fn foo((a): u8) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:22:14 + --> $DIR/issue-54538-unused-parens-lint.rs:21:14 | LL | let _ = |(a): u8| 0; | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:50:12 + --> $DIR/issue-54538-unused-parens-lint.rs:49:12 | LL | if let (0 | 1) = 0 {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:51:13 + --> $DIR/issue-54538-unused-parens-lint.rs:50:13 | LL | if let ((0 | 1),) = (0,) {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:52:13 + --> $DIR/issue-54538-unused-parens-lint.rs:51:13 | LL | if let [(0 | 1)] = [0] {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:53:16 + --> $DIR/issue-54538-unused-parens-lint.rs:52:16 | LL | if let 0 | (1 | 2) = 0 {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:55:15 + --> $DIR/issue-54538-unused-parens-lint.rs:54:15 | LL | if let TS((0 | 1)) = TS(0) {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:57:20 + --> $DIR/issue-54538-unused-parens-lint.rs:56:20 | LL | if let NS { f: (0 | 1) } = (NS { f: 0 }) {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:67:9 + --> $DIR/issue-54538-unused-parens-lint.rs:66:9 | LL | (_) => {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:68:9 + --> $DIR/issue-54538-unused-parens-lint.rs:67:9 | LL | (y) => {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:69:9 + --> $DIR/issue-54538-unused-parens-lint.rs:68:9 | LL | (ref r) => {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:70:9 + --> $DIR/issue-54538-unused-parens-lint.rs:69:9 | LL | (e @ 1...2) => {} | ^^^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:76:9 + --> $DIR/issue-54538-unused-parens-lint.rs:75:9 | LL | (e @ &(1...2)) => {} | ^^^^^^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:77:10 + --> $DIR/issue-54538-unused-parens-lint.rs:76:10 | LL | &(_) => {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:88:9 + --> $DIR/issue-54538-unused-parens-lint.rs:87:9 | LL | (_) => {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:89:9 + --> $DIR/issue-54538-unused-parens-lint.rs:88:9 | LL | (y) => {} | ^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:90:9 + --> $DIR/issue-54538-unused-parens-lint.rs:89:9 | LL | (ref r) => {} | ^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:91:9 + --> $DIR/issue-54538-unused-parens-lint.rs:90:9 | LL | (e @ 1..=2) => {} | ^^^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:97:9 + --> $DIR/issue-54538-unused-parens-lint.rs:96:9 | LL | (e @ &(1..=2)) => {} | ^^^^^^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:98:10 + --> $DIR/issue-54538-unused-parens-lint.rs:97:10 | LL | &(_) => {} | ^^^ help: remove these parentheses diff --git a/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.rs b/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.rs index b21f1ef6b2603..e3631d014d63b 100644 --- a/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.rs +++ b/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.rs @@ -1,7 +1,6 @@ // FIXME: should be run-rustfix, but rustfix doesn't currently support multipart suggestions, see // #53934 -#![feature(or_patterns)] #![deny(unused)] pub enum MyEnum { diff --git a/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.stderr b/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.stderr index 9cff2900908e6..8aefe243a944b 100644 --- a/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.stderr +++ b/src/test/ui/lint/issue-67691-unused-field-in-or-pattern.stderr @@ -1,11 +1,11 @@ error: unused variable: `j` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:21:16 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:20:16 | LL | A { i, j } | B { i, j } => { | ^ ^ | note: the lint level is defined here - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:5:9 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:4:9 | LL | #![deny(unused)] | ^^^^^^ @@ -16,7 +16,7 @@ LL | A { i, j: _ } | B { i, j: _ } => { | ^^^^ ^^^^ error: unused variable: `j` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:31:16 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 | LL | A { i, ref j } | B { i, ref j } => { | ^^^^^ ^^^^^ @@ -27,7 +27,7 @@ LL | A { i, j: _ } | B { i, j: _ } => { | ^^^^ ^^^^ error: unused variable: `j` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:41:21 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:40:21 | LL | Some(A { i, j } | B { i, j }) => { | ^ ^ @@ -38,7 +38,7 @@ LL | Some(A { i, j: _ } | B { i, j: _ }) => { | ^^^^ ^^^^ error: unused variable: `j` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:53:21 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 | LL | Some(A { i, ref j } | B { i, ref j }) => { | ^^^^^ ^^^^^ @@ -49,7 +49,7 @@ LL | Some(A { i, j: _ } | B { i, j: _ }) => { | ^^^^ ^^^^ error: unused variable: `i` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:63:24 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:62:24 | LL | MixedEnum::A { i } | MixedEnum::B(i) => { | ^ ^ @@ -60,7 +60,7 @@ LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => { | ^^^^ ^ error: unused variable: `i` - --> $DIR/issue-67691-unused-field-in-or-pattern.rs:71:24 + --> $DIR/issue-67691-unused-field-in-or-pattern.rs:70:24 | LL | MixedEnum::A { ref i } | MixedEnum::B(ref i) => { | ^^^^^ ^^^^^ diff --git a/src/test/ui/macros/edition-macro-pats.rs b/src/test/ui/macros/edition-macro-pats.rs index ea1f9bff6bf70..b8f9f12f41380 100644 --- a/src/test/ui/macros/edition-macro-pats.rs +++ b/src/test/ui/macros/edition-macro-pats.rs @@ -1,6 +1,5 @@ // run-pass -#![feature(or_patterns)] #![feature(edition_macro_pats)] macro_rules! foo { diff --git a/src/test/ui/match/issue-72680.rs b/src/test/ui/match/issue-72680.rs index 5b933edc8205e..c13cace760086 100644 --- a/src/test/ui/match/issue-72680.rs +++ b/src/test/ui/match/issue-72680.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(or_patterns)] - fn main() { assert!(f("", 0)); assert!(f("a", 1)); diff --git a/src/test/ui/or-patterns/already-bound-name.rs b/src/test/ui/or-patterns/already-bound-name.rs index 543d7c21c8317..65c25293d9ecc 100644 --- a/src/test/ui/or-patterns/already-bound-name.rs +++ b/src/test/ui/or-patterns/already-bound-name.rs @@ -1,8 +1,6 @@ // This test ensures that the "already bound identifier in a product pattern" // correctly accounts for or-patterns. -#![feature(or_patterns)] - enum E { A(T, T), B(T) } use E::*; diff --git a/src/test/ui/or-patterns/already-bound-name.stderr b/src/test/ui/or-patterns/already-bound-name.stderr index 483154a5e3274..66112165622b9 100644 --- a/src/test/ui/or-patterns/already-bound-name.stderr +++ b/src/test/ui/or-patterns/already-bound-name.stderr @@ -1,89 +1,89 @@ error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:11:13 + --> $DIR/already-bound-name.rs:9:13 | LL | let (a, a) = (0, 1); // Standard duplication without an or-pattern. | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:14:15 + --> $DIR/already-bound-name.rs:12:15 | LL | let (a, A(a, _) | B(a)) = (0, A(1, 2)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:14:25 + --> $DIR/already-bound-name.rs:12:25 | LL | let (a, A(a, _) | B(a)) = (0, A(1, 2)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:18:26 + --> $DIR/already-bound-name.rs:16:26 | LL | let (A(a, _) | B(a), a) = (A(0, 1), 2); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:21:15 + --> $DIR/already-bound-name.rs:19:15 | LL | let (A(a, a) | B(a)) = A(0, 1); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:24:22 + --> $DIR/already-bound-name.rs:22:22 | LL | let (B(a) | A(a, a)) = A(0, 1); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:28:21 + --> $DIR/already-bound-name.rs:26:21 | LL | B(a) | A(a, a) => {} // Let's ensure `match` has no funny business. | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:32:37 + --> $DIR/already-bound-name.rs:30:37 | LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:32:47 + --> $DIR/already-bound-name.rs:30:47 | LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:37:37 + --> $DIR/already-bound-name.rs:35:37 | LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:37:47 + --> $DIR/already-bound-name.rs:35:47 | LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0408]: variable `a` is not bound in all patterns - --> $DIR/already-bound-name.rs:37:10 + --> $DIR/already-bound-name.rs:35:10 | LL | let (B(_) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1)); | ^^^^ pattern doesn't bind `a` - variable not in all patterns error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:42:50 + --> $DIR/already-bound-name.rs:40:50 | LL | let (B(A(a, _) | B(a)) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/already-bound-name.rs:42:60 + --> $DIR/already-bound-name.rs:40:60 | LL | let (B(A(a, _) | B(a)) | A(A(a, _) | B(a), A(a, _) | B(a))) = B(B(1)); | ^ used in a pattern more than once error[E0308]: mismatched types - --> $DIR/already-bound-name.rs:32:32 + --> $DIR/already-bound-name.rs:30:32 | LL | let (B(A(a, _) | B(a)) | A(a, A(a, _) | B(a))) = B(B(1)); | - ^ ------- this expression has type `E>` diff --git a/src/test/ui/or-patterns/basic-switch.rs b/src/test/ui/or-patterns/basic-switch.rs index 6daa9d9255b80..674fbc3cc99fc 100644 --- a/src/test/ui/or-patterns/basic-switch.rs +++ b/src/test/ui/or-patterns/basic-switch.rs @@ -3,8 +3,6 @@ // run-pass -#![feature(or_patterns)] - #[derive(Debug)] enum Test { Foo, diff --git a/src/test/ui/or-patterns/basic-switchint.rs b/src/test/ui/or-patterns/basic-switchint.rs index c5a6d894eacec..adb902caf011d 100644 --- a/src/test/ui/or-patterns/basic-switchint.rs +++ b/src/test/ui/or-patterns/basic-switchint.rs @@ -3,8 +3,6 @@ // run-pass -#![feature(or_patterns)] - #[derive(Debug, PartialEq)] enum MatchArm { Arm(usize), diff --git a/src/test/ui/or-patterns/bindings-runpass-1.rs b/src/test/ui/or-patterns/bindings-runpass-1.rs index 0087167af7ecc..3406d5197c497 100644 --- a/src/test/ui/or-patterns/bindings-runpass-1.rs +++ b/src/test/ui/or-patterns/bindings-runpass-1.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(or_patterns)] - fn two_bindings(x: &((bool, bool), u8)) -> u8 { match x { &((true, y) | (y, true), z @ (0 | 4)) => (y as u8) + z, diff --git a/src/test/ui/or-patterns/bindings-runpass-2.rs b/src/test/ui/or-patterns/bindings-runpass-2.rs index 0e1eb7b2e030b..5b9bb748c7cee 100644 --- a/src/test/ui/or-patterns/bindings-runpass-2.rs +++ b/src/test/ui/or-patterns/bindings-runpass-2.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(or_patterns)] - fn or_at(x: Result) -> u32 { match x { Ok(x @ 4) | Err(x @ (6 | 8)) => x, diff --git a/src/test/ui/or-patterns/box-patterns.rs b/src/test/ui/or-patterns/box-patterns.rs index aafd47993836c..73051401c181e 100644 --- a/src/test/ui/or-patterns/box-patterns.rs +++ b/src/test/ui/or-patterns/box-patterns.rs @@ -2,7 +2,6 @@ // run-pass -#![feature(or_patterns)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] diff --git a/src/test/ui/or-patterns/consistent-bindings.rs b/src/test/ui/or-patterns/consistent-bindings.rs index 853ddcf241232..ecae1d8a2732a 100644 --- a/src/test/ui/or-patterns/consistent-bindings.rs +++ b/src/test/ui/or-patterns/consistent-bindings.rs @@ -4,8 +4,6 @@ // check-pass -#![feature(or_patterns)] - fn main() { // One level: let (Ok(a) | Err(a)) = Ok(0); diff --git a/src/test/ui/or-patterns/const-fn.rs b/src/test/ui/or-patterns/const-fn.rs index 55c6f60915fa8..ca512ac711905 100644 --- a/src/test/ui/or-patterns/const-fn.rs +++ b/src/test/ui/or-patterns/const-fn.rs @@ -1,5 +1,4 @@ // check-pass -#![feature(or_patterns)] const fn foo((Ok(a) | Err(a)): Result) { let x = Ok(3); diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs index f2d5de75b65bd..5999e04e0e2dd 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs @@ -1,4 +1,3 @@ -#![feature(or_patterns)] #![deny(unreachable_patterns)] // We wrap patterns in a tuple because top-level or-patterns were special-cased. diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index d3ae798ead5a7..44f334eee9386 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(2_u8..=u8::MAX, _)` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:6:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:5:11 | LL | match (0u8, 0u8) { | ^^^^^^^^^^ pattern `(2_u8..=u8::MAX, _)` not covered @@ -8,7 +8,7 @@ LL | match (0u8, 0u8) { = note: the matched value is of type `(u8, u8)` error[E0004]: non-exhaustive patterns: `((4_u8..=u8::MAX))` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:10:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:9:11 | LL | match ((0u8,),) { | ^^^^^^^^^ pattern `((4_u8..=u8::MAX))` not covered @@ -17,7 +17,7 @@ LL | match ((0u8,),) { = note: the matched value is of type `((u8,),)` error[E0004]: non-exhaustive patterns: `(Some(2_u8..=u8::MAX))` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:14:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:13:11 | LL | match (Some(0u8),) { | ^^^^^^^^^^^^ pattern `(Some(2_u8..=u8::MAX))` not covered diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.rs b/src/test/ui/or-patterns/exhaustiveness-pass.rs index 8dcf8792f6f96..e8c8a0e7ba52a 100644 --- a/src/test/ui/or-patterns/exhaustiveness-pass.rs +++ b/src/test/ui/or-patterns/exhaustiveness-pass.rs @@ -1,4 +1,3 @@ -#![feature(or_patterns)] #![deny(unreachable_patterns)] // check-pass diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs index bdb7a1ec92b7f..8429799cabf15 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs @@ -1,4 +1,3 @@ -#![feature(or_patterns)] #![deny(unreachable_patterns)] // We wrap patterns in a tuple because top-level or-patterns were special-cased. diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index 51991fc603967..a84681e0056f0 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -1,138 +1,138 @@ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:8:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:7:9 | LL | (1,) => {} | ^^^^ | note: the lint level is defined here - --> $DIR/exhaustiveness-unreachable-pattern.rs:2:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:13:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:12:9 | LL | (2,) => {} | ^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:18:9 | LL | (1 | 2,) => {} | ^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:24:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:23:9 | LL | (1, 3) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:25:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:24:9 | LL | (1, 4) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:25:9 | LL | (2, 4) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:27:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 | LL | (2 | 1, 4) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:28:9 | LL | (1, 4 | 5) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:37:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:36:9 | LL | (Some(1),) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:38:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:37:9 | LL | (None,) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:43:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:42:9 | LL | ((1..=4,),) => {} | ^^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:48:14 + --> $DIR/exhaustiveness-unreachable-pattern.rs:47:14 | LL | (1 | 1,) => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:52:19 + --> $DIR/exhaustiveness-unreachable-pattern.rs:51:19 | LL | (0 | 1) | 1 => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:58:14 + --> $DIR/exhaustiveness-unreachable-pattern.rs:57:14 | LL | 0 | (0 | 0) => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:58:18 + --> $DIR/exhaustiveness-unreachable-pattern.rs:57:18 | LL | 0 | (0 | 0) => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:66:13 + --> $DIR/exhaustiveness-unreachable-pattern.rs:65:13 | LL | / Some( LL | | 0 | 0) => {} | |______________________^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:72:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:71:15 | LL | | 0 | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:74:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:73:15 | LL | | 0] => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:82:10 + --> $DIR/exhaustiveness-unreachable-pattern.rs:81:10 | LL | [1 | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:94:10 + --> $DIR/exhaustiveness-unreachable-pattern.rs:93:10 | LL | [true | ^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:101:36 + --> $DIR/exhaustiveness-unreachable-pattern.rs:100:36 | LL | (true | false, None | Some(true | ^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:106:14 + --> $DIR/exhaustiveness-unreachable-pattern.rs:105:14 | LL | (true | ^^^^ @@ -143,25 +143,25 @@ LL | (true | false, None | Some(t_or_f!())) => {} = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:117:14 + --> $DIR/exhaustiveness-unreachable-pattern.rs:116:14 | LL | Some(0 | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:136:19 + --> $DIR/exhaustiveness-unreachable-pattern.rs:135:19 | LL | | false) => {} | ^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:144:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:143:15 | LL | | true) => {} | ^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:150:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:149:15 | LL | | true, | ^^^^ diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.rs b/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.rs deleted file mode 100644 index de8e1bba5576c..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.rs +++ /dev/null @@ -1,8 +0,0 @@ -// Test feature gating for a sole leading `|` in `let`. - -fn main() {} - -#[cfg(FALSE)] -fn gated_leading_vert_in_let() { - for | A in 0 {} //~ ERROR or-patterns syntax is experimental -} diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.stderr b/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.stderr deleted file mode 100644 index abcee43553020..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-for.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns-leading-for.rs:7:9 - | -LL | for | A in 0 {} - | ^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.rs b/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.rs deleted file mode 100644 index 6c592550ec257..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Test feature gating for a sole leading `|` in `let`. - -fn main() {} - -#[cfg(FALSE)] -fn gated_leading_vert_in_let() { - let | A; //~ ERROR or-patterns syntax is experimental - //~^ ERROR top-level or-patterns are not allowed -} diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.stderr b/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.stderr deleted file mode 100644 index d556532cd6ad8..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns-leading-let.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/feature-gate-or_patterns-leading-let.rs:7:9 - | -LL | let | A; - | ^^^ help: remove the `|`: `A` - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns-leading-let.rs:7:9 - | -LL | let | A; - | ^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns.rs b/src/test/ui/or-patterns/feature-gate-or_patterns.rs deleted file mode 100644 index 8bb45e606be96..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns.rs +++ /dev/null @@ -1,54 +0,0 @@ -fn main() {} - -pub fn example(x: Option) { - match x { - Some(0 | 1 | 2) => {} - //~^ ERROR: or-patterns syntax is experimental - _ => {} - } -} - -// Test the `pat` macro fragment parser: -macro_rules! accept_pat { - ($p:pat) => {} -} - -accept_pat!((p | q)); //~ ERROR or-patterns syntax is experimental -accept_pat!((p | q,)); //~ ERROR or-patterns syntax is experimental -accept_pat!(TS(p | q)); //~ ERROR or-patterns syntax is experimental -accept_pat!(NS { f: p | q }); //~ ERROR or-patterns syntax is experimental -accept_pat!([p | q]); //~ ERROR or-patterns syntax is experimental - -// Non-macro tests: - -#[cfg(FALSE)] -fn or_patterns() { - // Gated: - - let | A | B; //~ ERROR or-patterns syntax is experimental - //~^ ERROR top-level or-patterns are not allowed - let A | B; //~ ERROR or-patterns syntax is experimental - //~^ ERROR top-level or-patterns are not allowed - for | A | B in 0 {} //~ ERROR or-patterns syntax is experimental - for A | B in 0 {} //~ ERROR or-patterns syntax is experimental - fn fun((A | B): _) {} //~ ERROR or-patterns syntax is experimental - let _ = |(A | B): u8| (); //~ ERROR or-patterns syntax is experimental - let (A | B); //~ ERROR or-patterns syntax is experimental - let (A | B,); //~ ERROR or-patterns syntax is experimental - let A(B | C); //~ ERROR or-patterns syntax is experimental - let E::V(B | C); //~ ERROR or-patterns syntax is experimental - let S { f1: B | C, f2 }; //~ ERROR or-patterns syntax is experimental - let E::V { f1: B | C, f2 }; //~ ERROR or-patterns syntax is experimental - let [A | B]; //~ ERROR or-patterns syntax is experimental - - // Top level of `while`, `if`, and `match` arms are allowed: - - while let | A = 0 {} - while let A | B = 0 {} - if let | A = 0 {} - if let A | B = 0 {} - match 0 { - | A => {}, - A | B => {}, - } -} diff --git a/src/test/ui/or-patterns/feature-gate-or_patterns.stderr b/src/test/ui/or-patterns/feature-gate-or_patterns.stderr deleted file mode 100644 index 7988af5b94213..0000000000000 --- a/src/test/ui/or-patterns/feature-gate-or_patterns.stderr +++ /dev/null @@ -1,186 +0,0 @@ -error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/feature-gate-or_patterns.rs:28:9 - | -LL | let | A | B; - | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` - -error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/feature-gate-or_patterns.rs:30:9 - | -LL | let A | B; - | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:5:14 - | -LL | Some(0 | 1 | 2) => {} - | ^^^^^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:28:9 - | -LL | let | A | B; - | ^^^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:30:9 - | -LL | let A | B; - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:32:9 - | -LL | for | A | B in 0 {} - | ^^^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:33:9 - | -LL | for A | B in 0 {} - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:34:13 - | -LL | fn fun((A | B): _) {} - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:35:15 - | -LL | let _ = |(A | B): u8| (); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:36:10 - | -LL | let (A | B); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:37:10 - | -LL | let (A | B,); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:38:11 - | -LL | let A(B | C); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:39:14 - | -LL | let E::V(B | C); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:40:17 - | -LL | let S { f1: B | C, f2 }; - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:41:20 - | -LL | let E::V { f1: B | C, f2 }; - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:42:10 - | -LL | let [A | B]; - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:16:14 - | -LL | accept_pat!((p | q)); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:17:14 - | -LL | accept_pat!((p | q,)); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:18:16 - | -LL | accept_pat!(TS(p | q)); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:19:21 - | -LL | accept_pat!(NS { f: p | q }); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error[E0658]: or-patterns syntax is experimental - --> $DIR/feature-gate-or_patterns.rs:20:14 - | -LL | accept_pat!([p | q]); - | ^^^^^ - | - = note: see issue #54883 for more information - = help: add `#![feature(or_patterns)]` to the crate attributes to enable - -error: aborting due to 21 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/or-patterns/fn-param-wrap-parens.fixed b/src/test/ui/or-patterns/fn-param-wrap-parens.fixed index 65e04325e16bd..b9490aaf9de05 100644 --- a/src/test/ui/or-patterns/fn-param-wrap-parens.fixed +++ b/src/test/ui/or-patterns/fn-param-wrap-parens.fixed @@ -2,7 +2,6 @@ // run-rustfix -#![feature(or_patterns)] #![allow(warnings)] fn main() {} diff --git a/src/test/ui/or-patterns/fn-param-wrap-parens.rs b/src/test/ui/or-patterns/fn-param-wrap-parens.rs index aeb4a05ea808e..8e703d274c785 100644 --- a/src/test/ui/or-patterns/fn-param-wrap-parens.rs +++ b/src/test/ui/or-patterns/fn-param-wrap-parens.rs @@ -2,7 +2,6 @@ // run-rustfix -#![feature(or_patterns)] #![allow(warnings)] fn main() {} diff --git a/src/test/ui/or-patterns/fn-param-wrap-parens.stderr b/src/test/ui/or-patterns/fn-param-wrap-parens.stderr index 96193c17ae23f..73270284131f9 100644 --- a/src/test/ui/or-patterns/fn-param-wrap-parens.stderr +++ b/src/test/ui/or-patterns/fn-param-wrap-parens.stderr @@ -1,5 +1,5 @@ error: top-level or-patterns are not allowed in function parameters - --> $DIR/fn-param-wrap-parens.rs:14:9 + --> $DIR/fn-param-wrap-parens.rs:13:9 | LL | fn fun1(A | B: E) {} | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` diff --git a/src/test/ui/or-patterns/for-loop.rs b/src/test/ui/or-patterns/for-loop.rs index b79af6c402ec5..11b61cb69f1d2 100644 --- a/src/test/ui/or-patterns/for-loop.rs +++ b/src/test/ui/or-patterns/for-loop.rs @@ -1,8 +1,6 @@ // Check that or patterns are lowered correctly in `for` loops. // run-pass -#![feature(or_patterns)] - fn main() { let v = vec![Ok(2), Err(3), Ok(5)]; let mut w = Vec::new(); diff --git a/src/test/ui/or-patterns/if-let-while-let.rs b/src/test/ui/or-patterns/if-let-while-let.rs index 9256360b29db9..92a1bb256668b 100644 --- a/src/test/ui/or-patterns/if-let-while-let.rs +++ b/src/test/ui/or-patterns/if-let-while-let.rs @@ -1,8 +1,6 @@ // Check that or patterns are lowered correctly in `if let` and `while let` expressions. // run-pass -#![feature(or_patterns)] - fn main() { let mut opt = Some(3); let mut w = Vec::new(); diff --git a/src/test/ui/or-patterns/inconsistent-modes.rs b/src/test/ui/or-patterns/inconsistent-modes.rs index 2300e9f9f3b7b..a87a10ce8a4ca 100644 --- a/src/test/ui/or-patterns/inconsistent-modes.rs +++ b/src/test/ui/or-patterns/inconsistent-modes.rs @@ -1,6 +1,5 @@ // This test ensures that or patterns require binding mode consistency across arms. -#![feature(or_patterns)] #![allow(non_camel_case_types)] fn main() { // One level: diff --git a/src/test/ui/or-patterns/inconsistent-modes.stderr b/src/test/ui/or-patterns/inconsistent-modes.stderr index 99791431eaf25..dae6bb41e74e2 100644 --- a/src/test/ui/or-patterns/inconsistent-modes.stderr +++ b/src/test/ui/or-patterns/inconsistent-modes.stderr @@ -1,5 +1,5 @@ error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:7:26 + --> $DIR/inconsistent-modes.rs:6:26 | LL | let (Ok(a) | Err(ref a)): Result<&u8, u8> = Ok(&0); | - ^ bound in different ways @@ -7,7 +7,7 @@ LL | let (Ok(a) | Err(ref a)): Result<&u8, u8> = Ok(&0); | first binding error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:9:30 + --> $DIR/inconsistent-modes.rs:8:30 | LL | let (Ok(ref mut a) | Err(a)): Result = Ok(0); | - ^ bound in different ways @@ -15,25 +15,25 @@ LL | let (Ok(ref mut a) | Err(a)): Result = Ok(0); | first binding error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:11:34 + --> $DIR/inconsistent-modes.rs:10:34 | LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0); | - first binding ^ bound in different ways error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:14:40 + --> $DIR/inconsistent-modes.rs:13:40 | LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0)); | - first binding ^ bound in different ways error[E0409]: variable `b` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:14:47 + --> $DIR/inconsistent-modes.rs:13:47 | LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0)); | - first binding ^ bound in different ways error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:20:39 + --> $DIR/inconsistent-modes.rs:19:39 | LL | let (Ok(Ok(a) | Err(a)) | Err(ref a)) = Err(0); | - ^ bound in different ways @@ -41,7 +41,7 @@ LL | let (Ok(Ok(a) | Err(a)) | Err(ref a)) = Err(0); | first binding error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|` - --> $DIR/inconsistent-modes.rs:24:34 + --> $DIR/inconsistent-modes.rs:23:34 | LL | let (Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a)) = Err(&1); | - ^ bound in different ways @@ -49,7 +49,7 @@ LL | let (Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a)) = Err(&1); | first binding error[E0308]: mismatched types - --> $DIR/inconsistent-modes.rs:11:26 + --> $DIR/inconsistent-modes.rs:10:26 | LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0); | ----- ^^^^^^^^^ -------------------- expected due to this @@ -62,7 +62,7 @@ LL | let (Ok(ref a) | Err(ref mut a)): Result<&u8, &mut u8> = Ok(&0); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/inconsistent-modes.rs:14:32 + --> $DIR/inconsistent-modes.rs:13:32 | LL | let (Ok((ref a, b)) | Err((ref mut a, ref b))) = Ok((0, &0)); | ----- ^^^^^^^^^ ----------- this expression has type `Result<({integer}, &{integer}), (_, _)>` diff --git a/src/test/ui/or-patterns/issue-67514-irrefutable-param.rs b/src/test/ui/or-patterns/issue-67514-irrefutable-param.rs index 0c2ae44e546d9..73931def89584 100644 --- a/src/test/ui/or-patterns/issue-67514-irrefutable-param.rs +++ b/src/test/ui/or-patterns/issue-67514-irrefutable-param.rs @@ -2,8 +2,6 @@ // check-pass -#![feature(or_patterns)] - fn foo((Some(_) | None): Option) {} fn main() { diff --git a/src/test/ui/or-patterns/issue-68785-irrefutable-param-with-at.rs b/src/test/ui/or-patterns/issue-68785-irrefutable-param-with-at.rs index 1a65a1e544b9e..7339a7e23f9e2 100644 --- a/src/test/ui/or-patterns/issue-68785-irrefutable-param-with-at.rs +++ b/src/test/ui/or-patterns/issue-68785-irrefutable-param-with-at.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(or_patterns)] - enum MyEnum { FirstCase(u8), OtherCase(u16), diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs index 8e83acc6dcbc0..3538aad5d772f 100644 --- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs +++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs @@ -1,5 +1,3 @@ -#![feature(or_patterns)] - fn main() { let (0 | (1 | 2)) = 0; //~ ERROR refutable pattern in local binding match 0 { diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr index 9ed942d9e0fd5..61175b84ee1de 100644 --- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered - --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:4:10 + --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:2:10 | LL | let (0 | (1 | 2)) = 0; | ^^^^^^^^^^^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered @@ -13,7 +13,7 @@ LL | if let (0 | (1 | 2)) = 0 { /* */ } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0004]: non-exhaustive patterns: `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered - --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:5:11 + --> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:3:11 | LL | match 0 { | ^ patterns `i32::MIN..=-1_i32` and `3_i32..=i32::MAX` not covered diff --git a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier.rs b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier.rs index 2f080ebf7830b..408ac24f39a49 100644 --- a/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier.rs +++ b/src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier.rs @@ -1,7 +1,5 @@ // check-pass -#![feature(or_patterns)] - fn main() { let (0 | (1 | _)) = 0; if let 0 | (1 | 2) = 0 {} diff --git a/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs b/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs index eb6706e50006f..8a3c640b10dee 100644 --- a/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs +++ b/src/test/ui/or-patterns/issue-70413-no-unreachable-pat-and-guard.rs @@ -2,7 +2,6 @@ #![deny(unreachable_patterns)] -#![feature(or_patterns)] fn main() { match (3,42) { (a,_) | (_,a) if a > 10 => {println!("{}", a)} diff --git a/src/test/ui/or-patterns/let-pattern.rs b/src/test/ui/or-patterns/let-pattern.rs index 7f22aa9d9f980..97207e83e2e65 100644 --- a/src/test/ui/or-patterns/let-pattern.rs +++ b/src/test/ui/or-patterns/let-pattern.rs @@ -1,5 +1,3 @@ -#![feature(or_patterns)] - // run-pass fn or_pat_let(x: Result) -> u32 { diff --git a/src/test/ui/or-patterns/macro-pat.rs b/src/test/ui/or-patterns/macro-pat.rs index 8749407675b37..8c581b630dece 100644 --- a/src/test/ui/or-patterns/macro-pat.rs +++ b/src/test/ui/or-patterns/macro-pat.rs @@ -3,8 +3,6 @@ // ignore-test // FIXME(mark-i-m): enable this test again when 2021 machinery is available -#![feature(or_patterns)] - use Foo::*; #[derive(Eq, PartialEq, Debug)] diff --git a/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs b/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs index cf98a472106e8..d1cb73aafa0c0 100644 --- a/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs +++ b/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs @@ -1,8 +1,6 @@ // Regression test for #71297 // edition:2018 -#![feature(or_patterns)] - async fn a((x | s): String) {} //~^ ERROR variable `x` is not bound in all patterns //~| ERROR variable `s` is not bound in all patterns diff --git a/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr b/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr index d5c77ee39c99c..81602fffa8d07 100644 --- a/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr +++ b/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `s` is not bound in all patterns - --> $DIR/mismatched-bindings-async-fn.rs:6:13 + --> $DIR/mismatched-bindings-async-fn.rs:4:13 | LL | async fn a((x | s): String) {} | ^ - variable not in all patterns @@ -7,7 +7,7 @@ LL | async fn a((x | s): String) {} | pattern doesn't bind `s` error[E0408]: variable `x` is not bound in all patterns - --> $DIR/mismatched-bindings-async-fn.rs:6:17 + --> $DIR/mismatched-bindings-async-fn.rs:4:17 | LL | async fn a((x | s): String) {} | - ^ pattern doesn't bind `x` @@ -15,7 +15,7 @@ LL | async fn a((x | s): String) {} | variable not in all patterns error[E0408]: variable `s` is not bound in all patterns - --> $DIR/mismatched-bindings-async-fn.rs:11:10 + --> $DIR/mismatched-bindings-async-fn.rs:9:10 | LL | let (x | s) = String::new(); | ^ - variable not in all patterns @@ -23,7 +23,7 @@ LL | let (x | s) = String::new(); | pattern doesn't bind `s` error[E0408]: variable `x` is not bound in all patterns - --> $DIR/mismatched-bindings-async-fn.rs:11:14 + --> $DIR/mismatched-bindings-async-fn.rs:9:14 | LL | let (x | s) = String::new(); | - ^ pattern doesn't bind `x` diff --git a/src/test/ui/or-patterns/missing-bindings.rs b/src/test/ui/or-patterns/missing-bindings.rs index 5dd1f16b65580..7c26012c0e93d 100644 --- a/src/test/ui/or-patterns/missing-bindings.rs +++ b/src/test/ui/or-patterns/missing-bindings.rs @@ -2,7 +2,6 @@ // edition:2018 -#![feature(or_patterns)] #![allow(non_camel_case_types)] fn main() {} diff --git a/src/test/ui/or-patterns/missing-bindings.stderr b/src/test/ui/or-patterns/missing-bindings.stderr index 4702bc6bbf322..c173a3a9aba20 100644 --- a/src/test/ui/or-patterns/missing-bindings.stderr +++ b/src/test/ui/or-patterns/missing-bindings.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `beta` is not bound in all patterns - --> $DIR/missing-bindings.rs:20:10 + --> $DIR/missing-bindings.rs:19:10 | LL | let (alpha | beta | charlie) = alpha; | ^^^^^ ---- ^^^^^^^ pattern doesn't bind `beta` @@ -8,7 +8,7 @@ LL | let (alpha | beta | charlie) = alpha; | pattern doesn't bind `beta` error[E0408]: variable `beta` is not bound in all patterns - --> $DIR/missing-bindings.rs:22:14 + --> $DIR/missing-bindings.rs:21:14 | LL | Some(alpha | beta) => {} | ^^^^^ ---- variable not in all patterns @@ -16,7 +16,7 @@ LL | Some(alpha | beta) => {} | pattern doesn't bind `beta` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:34:20 + --> $DIR/missing-bindings.rs:33:20 | LL | let (A(a, _) | _) = X; | - ^ pattern doesn't bind `a` @@ -24,7 +24,7 @@ LL | let (A(a, _) | _) = X; | variable not in all patterns error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:35:10 + --> $DIR/missing-bindings.rs:34:10 | LL | let (_ | B(a)) = X; | ^ - variable not in all patterns @@ -32,7 +32,7 @@ LL | let (_ | B(a)) = X; | pattern doesn't bind `a` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:36:10 + --> $DIR/missing-bindings.rs:35:10 | LL | let (A(..) | B(a)) = X; | ^^^^^ - variable not in all patterns @@ -40,7 +40,7 @@ LL | let (A(..) | B(a)) = X; | pattern doesn't bind `a` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:37:20 + --> $DIR/missing-bindings.rs:36:20 | LL | let (A(a, _) | B(_)) = X; | - ^^^^ pattern doesn't bind `a` @@ -48,7 +48,7 @@ LL | let (A(a, _) | B(_)) = X; | variable not in all patterns error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:38:20 + --> $DIR/missing-bindings.rs:37:20 | LL | let (A(_, a) | B(_)) = X; | - ^^^^ pattern doesn't bind `a` @@ -56,7 +56,7 @@ LL | let (A(_, a) | B(_)) = X; | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:39:20 + --> $DIR/missing-bindings.rs:38:20 | LL | let (A(a, b) | B(a)) = X; | - ^^^^ pattern doesn't bind `b` @@ -64,7 +64,7 @@ LL | let (A(a, b) | B(a)) = X; | variable not in all patterns error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:43:10 + --> $DIR/missing-bindings.rs:42:10 | LL | let (A(A(..) | B(_), _) | B(a)) = Y; | ^^^^^^^^^^^^^^^^^^ - variable not in all patterns @@ -72,7 +72,7 @@ LL | let (A(A(..) | B(_), _) | B(a)) = Y; | pattern doesn't bind `a` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:44:12 + --> $DIR/missing-bindings.rs:43:12 | LL | let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y; | ^^^^^ - variable not in all patterns @@ -80,7 +80,7 @@ LL | let (A(A(..) | B(a), _) | B(A(a, _) | B(a))) = Y; | pattern doesn't bind `a` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:22 + --> $DIR/missing-bindings.rs:45:22 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `a` @@ -88,7 +88,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:22 + --> $DIR/missing-bindings.rs:45:22 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `b` @@ -96,7 +96,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `c` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:12 + --> $DIR/missing-bindings.rs:45:12 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | ^^^^^^^ - variable not in all patterns @@ -104,7 +104,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | pattern doesn't bind `c` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:33 + --> $DIR/missing-bindings.rs:45:33 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `a` @@ -112,7 +112,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:33 + --> $DIR/missing-bindings.rs:45:33 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `b` @@ -120,7 +120,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `c` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:33 + --> $DIR/missing-bindings.rs:45:33 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `c` @@ -128,7 +128,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `d` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:33 + --> $DIR/missing-bindings.rs:45:33 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | - ^^^^ pattern doesn't bind `d` @@ -136,7 +136,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | variable not in all patterns error[E0408]: variable `e` is not bound in all patterns - --> $DIR/missing-bindings.rs:46:10 + --> $DIR/missing-bindings.rs:45:10 | LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | ^^^^^^^^^^^^^^^^^^^^ - variable not in all patterns @@ -144,7 +144,7 @@ LL | let (A(A(a, b) | B(c), d) | B(e)) = Y; | pattern doesn't bind `e` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:62:29 + --> $DIR/missing-bindings.rs:61:29 | LL | Ok(a) | Err(_), | - ^^^^^^ pattern doesn't bind `a` @@ -152,7 +152,7 @@ LL | Ok(a) | Err(_), | variable not in all patterns error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:70:21 + --> $DIR/missing-bindings.rs:69:21 | LL | A(_, a) | | - variable not in all patterns @@ -160,7 +160,7 @@ LL | B(b), | ^^^^ pattern doesn't bind `a` error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:69:21 + --> $DIR/missing-bindings.rs:68:21 | LL | A(_, a) | | ^^^^^^^ pattern doesn't bind `b` @@ -168,7 +168,7 @@ LL | B(b), | - variable not in all patterns error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:73:17 + --> $DIR/missing-bindings.rs:72:17 | LL | A(_, a) | | - variable not in all patterns @@ -177,7 +177,7 @@ LL | B(_) | ^^^^ pattern doesn't bind `a` error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:73:17 + --> $DIR/missing-bindings.rs:72:17 | LL | B(b), | - variable not in all patterns @@ -186,7 +186,7 @@ LL | B(_) | ^^^^ pattern doesn't bind `b` error[E0408]: variable `a` is not bound in all patterns - --> $DIR/missing-bindings.rs:77:13 + --> $DIR/missing-bindings.rs:76:13 | LL | B(Ok(a) | Err(a)) | - variable not in all patterns @@ -198,7 +198,7 @@ LL | V3(c), | ^^^^^ pattern doesn't bind `a` error[E0408]: variable `b` is not bound in all patterns - --> $DIR/missing-bindings.rs:58:13 + --> $DIR/missing-bindings.rs:57:13 | LL | / V1( LL | | @@ -216,7 +216,7 @@ LL | V3(c), | ^^^^^ pattern doesn't bind `b` error[E0408]: variable `c` is not bound in all patterns - --> $DIR/missing-bindings.rs:58:13 + --> $DIR/missing-bindings.rs:57:13 | LL | / V1( LL | | diff --git a/src/test/ui/or-patterns/mix-with-wild.rs b/src/test/ui/or-patterns/mix-with-wild.rs index 37f20df1b312d..d9911cda1b685 100644 --- a/src/test/ui/or-patterns/mix-with-wild.rs +++ b/src/test/ui/or-patterns/mix-with-wild.rs @@ -4,7 +4,6 @@ // 2) or-patterns should work with simplifyable patterns. // run-pass -#![feature(or_patterns)] pub fn test(x: Option) -> bool { match x { diff --git a/src/test/ui/or-patterns/multiple-pattern-typo.rs b/src/test/ui/or-patterns/multiple-pattern-typo.rs index 4d06101044f6c..5f201253304c4 100644 --- a/src/test/ui/or-patterns/multiple-pattern-typo.rs +++ b/src/test/ui/or-patterns/multiple-pattern-typo.rs @@ -1,4 +1,4 @@ -#![feature(or_patterns)] +//! Test for `||` in or-patterns fn main() { let x = 3; diff --git a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs index 11c8a7b69f948..fa470de7fb555 100644 --- a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs +++ b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs @@ -1,8 +1,6 @@ // Here we test type checking of bindings when combined with or-patterns. // Specifically, we ensure that introducing bindings of different types result in type errors. -#![feature(or_patterns)] - fn main() { enum Blah { A(isize, isize, usize), diff --git a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr index 26e14b539dbf2..00ce46c5690d5 100644 --- a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr +++ b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:13:39 + --> $DIR/or-patterns-binding-type-mismatch.rs:11:39 | LL | match Blah::A(1, 1, 2) { | ---------------- this expression has type `Blah` @@ -11,7 +11,7 @@ LL | Blah::A(_, x, y) | Blah::B(x, y) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:17:44 + --> $DIR/or-patterns-binding-type-mismatch.rs:15:44 | LL | match Some(Blah::A(1, 1, 2)) { | ---------------------- this expression has type `Option` @@ -23,7 +23,7 @@ LL | Some(Blah::A(_, x, y) | Blah::B(x, y)) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:21:19 + --> $DIR/or-patterns-binding-type-mismatch.rs:19:19 | LL | match (0u8, 1u16) { | ----------- this expression has type `(u8, u16)` @@ -35,7 +35,7 @@ LL | (x, y) | (y, x) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:21:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:19:22 | LL | match (0u8, 1u16) { | ----------- this expression has type `(u8, u16)` @@ -47,7 +47,7 @@ LL | (x, y) | (y, x) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:41 + --> $DIR/or-patterns-binding-type-mismatch.rs:24:41 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -59,7 +59,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:50 + --> $DIR/or-patterns-binding-type-mismatch.rs:24:50 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -71,7 +71,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:59 + --> $DIR/or-patterns-binding-type-mismatch.rs:24:59 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -83,7 +83,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:62 + --> $DIR/or-patterns-binding-type-mismatch.rs:24:62 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -93,7 +93,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:34:42 + --> $DIR/or-patterns-binding-type-mismatch.rs:32:42 | LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) { | - ^ ---------------- this expression has type `Blah` @@ -104,7 +104,7 @@ LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:38:47 + --> $DIR/or-patterns-binding-type-mismatch.rs:36:47 | LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2)) { | - ^ ---------------------- this expression has type `Option` @@ -115,7 +115,7 @@ LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2)) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:42:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:40:22 | LL | if let (x, y) | (y, x) = (0u8, 1u16) { | - ^ ----------- this expression has type `(u8, u16)` @@ -126,7 +126,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:42:25 + --> $DIR/or-patterns-binding-type-mismatch.rs:40:25 | LL | if let (x, y) | (y, x) = (0u8, 1u16) { | - ^ ----------- this expression has type `(u8, u16)` @@ -137,7 +137,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:44 + --> $DIR/or-patterns-binding-type-mismatch.rs:45:44 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u16`, found `u8` @@ -150,7 +150,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:53 + --> $DIR/or-patterns-binding-type-mismatch.rs:45:53 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u8`, found `u16` @@ -163,7 +163,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:62 + --> $DIR/or-patterns-binding-type-mismatch.rs:45:62 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u32`, found `u16` @@ -176,7 +176,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:65 + --> $DIR/or-patterns-binding-type-mismatch.rs:45:65 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - first introduced with type `u8` here ^ expected `u8`, found `u32` @@ -187,7 +187,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:55:40 + --> $DIR/or-patterns-binding-type-mismatch.rs:53:40 | LL | let (Blah::A(_, x, y) | Blah::B(x, y)) = Blah::A(1, 1, 2); | - ^ ---------------- this expression has type `Blah` @@ -198,7 +198,7 @@ LL | let (Blah::A(_, x, y) | Blah::B(x, y)) = Blah::A(1, 1, 2); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:58:20 + --> $DIR/or-patterns-binding-type-mismatch.rs:56:20 | LL | let ((x, y) | (y, x)) = (0u8, 1u16); | - ^ ----------- this expression has type `(u8, u16)` @@ -209,7 +209,7 @@ LL | let ((x, y) | (y, x)) = (0u8, 1u16); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:58:23 + --> $DIR/or-patterns-binding-type-mismatch.rs:56:23 | LL | let ((x, y) | (y, x)) = (0u8, 1u16); | - ^ ----------- this expression has type `(u8, u16)` @@ -220,7 +220,7 @@ LL | let ((x, y) | (y, x)) = (0u8, 1u16); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:62:42 + --> $DIR/or-patterns-binding-type-mismatch.rs:60:42 | LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {} | - ^ ---- expected due to this @@ -231,7 +231,7 @@ LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {} = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:65:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:63:22 | LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} | - ^ --------- expected due to this @@ -242,7 +242,7 @@ LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:65:25 + --> $DIR/or-patterns-binding-type-mismatch.rs:63:25 | LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} | - ^ --------- expected due to this diff --git a/src/test/ui/or-patterns/or-patterns-default-binding-modes.rs b/src/test/ui/or-patterns/or-patterns-default-binding-modes.rs index f98b038ae81af..e56f9ffe23c63 100644 --- a/src/test/ui/or-patterns/or-patterns-default-binding-modes.rs +++ b/src/test/ui/or-patterns/or-patterns-default-binding-modes.rs @@ -2,7 +2,6 @@ // check-pass -#![feature(or_patterns)] #![allow(irrefutable_let_patterns)] fn main() { diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-fail.rs b/src/test/ui/or-patterns/or-patterns-syntactic-fail.rs index 27a5374ff1848..358e9d034c474 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-fail.rs +++ b/src/test/ui/or-patterns/or-patterns-syntactic-fail.rs @@ -1,8 +1,6 @@ // Test some cases where or-patterns may ostensibly be allowed but are in fact not. // This is not a semantic test. We only test parsing. -#![feature(or_patterns)] - fn main() {} enum E { A, B } diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr index 929b2088f76ce..5406d51c644a5 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/src/test/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -1,29 +1,29 @@ error: top-level or-patterns are not allowed in function parameters - --> $DIR/or-patterns-syntactic-fail.rs:17:13 + --> $DIR/or-patterns-syntactic-fail.rs:15:13 | LL | fn fun1(A | B: E) {} | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in function parameters - --> $DIR/or-patterns-syntactic-fail.rs:20:13 + --> $DIR/or-patterns-syntactic-fail.rs:18:13 | LL | fn fun2(| A | B: E) {} | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/or-patterns-syntactic-fail.rs:25:9 + --> $DIR/or-patterns-syntactic-fail.rs:23:9 | LL | let A | B: E = A; | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/or-patterns-syntactic-fail.rs:28:9 + --> $DIR/or-patterns-syntactic-fail.rs:26:9 | LL | let | A | B: E = A; | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` error[E0369]: no implementation for `E | ()` - --> $DIR/or-patterns-syntactic-fail.rs:13:22 + --> $DIR/or-patterns-syntactic-fail.rs:11:22 | LL | let _ = |A | B: E| (); | ----^ -- () diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs index 3da238f7b9a45..6f9a631b092a7 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs +++ b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs @@ -3,8 +3,6 @@ // check-pass -#![feature(or_patterns)] - fn main() {} // Test the `pat` macro fragment parser: diff --git a/src/test/ui/or-patterns/remove-leading-vert.fixed b/src/test/ui/or-patterns/remove-leading-vert.fixed index d23858d42d146..b1cd0a94437f6 100644 --- a/src/test/ui/or-patterns/remove-leading-vert.fixed +++ b/src/test/ui/or-patterns/remove-leading-vert.fixed @@ -2,7 +2,6 @@ // run-rustfix -#![feature(or_patterns)] #![allow(warnings)] fn main() {} diff --git a/src/test/ui/or-patterns/remove-leading-vert.rs b/src/test/ui/or-patterns/remove-leading-vert.rs index e753765b3e795..dc12382aa3a23 100644 --- a/src/test/ui/or-patterns/remove-leading-vert.rs +++ b/src/test/ui/or-patterns/remove-leading-vert.rs @@ -2,7 +2,6 @@ // run-rustfix -#![feature(or_patterns)] #![allow(warnings)] fn main() {} diff --git a/src/test/ui/or-patterns/remove-leading-vert.stderr b/src/test/ui/or-patterns/remove-leading-vert.stderr index 0a2b143288dab..af51c67e1c8ba 100644 --- a/src/test/ui/or-patterns/remove-leading-vert.stderr +++ b/src/test/ui/or-patterns/remove-leading-vert.stderr @@ -1,11 +1,11 @@ error: top-level or-patterns are not allowed in function parameters - --> $DIR/remove-leading-vert.rs:12:14 + --> $DIR/remove-leading-vert.rs:11:14 | LL | fn fun1( | A: E) {} | ^^^ help: remove the `|`: `A` error: unexpected `||` before function parameter - --> $DIR/remove-leading-vert.rs:13:14 + --> $DIR/remove-leading-vert.rs:12:14 | LL | fn fun2( || A: E) {} | ^^ help: remove the `||` @@ -13,31 +13,31 @@ LL | fn fun2( || A: E) {} = note: alternatives in or-patterns are separated with `|`, not `||` error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:15:11 + --> $DIR/remove-leading-vert.rs:14:11 | LL | let ( || A): (E); | ^^ help: use a single `|` to separate multiple alternative patterns: `|` error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:18:11 + --> $DIR/remove-leading-vert.rs:17:11 | LL | let [ || A ]: [E; 1]; | ^^ help: use a single `|` to separate multiple alternative patterns: `|` error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:20:13 + --> $DIR/remove-leading-vert.rs:19:13 | LL | let TS( || A ): TS; | ^^ help: use a single `|` to separate multiple alternative patterns: `|` error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:22:17 + --> $DIR/remove-leading-vert.rs:21:17 | LL | let NS { f: || A }: NS; | ^^ help: use a single `|` to separate multiple alternative patterns: `|` error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:27:13 + --> $DIR/remove-leading-vert.rs:26:13 | LL | let ( A | ): E; | - ^ help: remove the `|` @@ -45,7 +45,7 @@ LL | let ( A | ): E; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:28:12 + --> $DIR/remove-leading-vert.rs:27:12 | LL | let (a |,): (E,); | - ^ help: remove the `|` @@ -53,7 +53,7 @@ LL | let (a |,): (E,); | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:29:17 + --> $DIR/remove-leading-vert.rs:28:17 | LL | let ( A | B | ): E; | - ^ help: remove the `|` @@ -61,7 +61,7 @@ LL | let ( A | B | ): E; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:30:17 + --> $DIR/remove-leading-vert.rs:29:17 | LL | let [ A | B | ]: [E; 1]; | - ^ help: remove the `|` @@ -69,7 +69,7 @@ LL | let [ A | B | ]: [E; 1]; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:31:18 + --> $DIR/remove-leading-vert.rs:30:18 | LL | let S { f: B | }; | - ^ help: remove the `|` @@ -77,7 +77,7 @@ LL | let S { f: B | }; | while parsing this or-pattern starting here error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:32:13 + --> $DIR/remove-leading-vert.rs:31:13 | LL | let ( A || B | ): E; | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` @@ -85,7 +85,7 @@ LL | let ( A || B | ): E; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:32:18 + --> $DIR/remove-leading-vert.rs:31:18 | LL | let ( A || B | ): E; | - ^ help: remove the `|` @@ -93,7 +93,7 @@ LL | let ( A || B | ): E; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:35:11 + --> $DIR/remove-leading-vert.rs:34:11 | LL | A | => {} | - ^ help: remove the `|` @@ -101,7 +101,7 @@ LL | A | => {} | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:36:11 + --> $DIR/remove-leading-vert.rs:35:11 | LL | A || => {} | - ^^ help: remove the `||` @@ -111,7 +111,7 @@ LL | A || => {} = note: alternatives in or-patterns are separated with `|`, not `||` error: unexpected token `||` in pattern - --> $DIR/remove-leading-vert.rs:37:11 + --> $DIR/remove-leading-vert.rs:36:11 | LL | A || B | => {} | - ^^ help: use a single `|` to separate multiple alternative patterns: `|` @@ -119,7 +119,7 @@ LL | A || B | => {} | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:37:16 + --> $DIR/remove-leading-vert.rs:36:16 | LL | A || B | => {} | - ^ help: remove the `|` @@ -127,7 +127,7 @@ LL | A || B | => {} | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:39:17 + --> $DIR/remove-leading-vert.rs:38:17 | LL | | A | B | => {} | - ^ help: remove the `|` @@ -135,7 +135,7 @@ LL | | A | B | => {} | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:46:11 + --> $DIR/remove-leading-vert.rs:45:11 | LL | let a | : u8 = 0; | - ^ help: remove the `|` @@ -143,7 +143,7 @@ LL | let a | : u8 = 0; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:47:11 + --> $DIR/remove-leading-vert.rs:46:11 | LL | let a | = 0; | - ^ help: remove the `|` @@ -151,7 +151,7 @@ LL | let a | = 0; | while parsing this or-pattern starting here error: a trailing `|` is not allowed in an or-pattern - --> $DIR/remove-leading-vert.rs:48:11 + --> $DIR/remove-leading-vert.rs:47:11 | LL | let a | ; | - ^ help: remove the `|` diff --git a/src/test/ui/or-patterns/search-via-bindings.rs b/src/test/ui/or-patterns/search-via-bindings.rs index 067e617373a63..d98606deda570 100644 --- a/src/test/ui/or-patterns/search-via-bindings.rs +++ b/src/test/ui/or-patterns/search-via-bindings.rs @@ -2,8 +2,6 @@ // run-pass -#![feature(or_patterns)] - fn search(target: (bool, bool, bool)) -> u32 { let x = ((false, true), (false, true), (false, true)); let mut guard_count = 0; diff --git a/src/test/ui/or-patterns/slice-patterns.rs b/src/test/ui/or-patterns/slice-patterns.rs index 05c907e824679..ed5eace0b7e6c 100644 --- a/src/test/ui/or-patterns/slice-patterns.rs +++ b/src/test/ui/or-patterns/slice-patterns.rs @@ -2,8 +2,6 @@ // run-pass -#![feature(or_patterns)] - #[derive(Debug, PartialEq)] enum MatchArm { Arm(usize), diff --git a/src/test/ui/or-patterns/struct-like.rs b/src/test/ui/or-patterns/struct-like.rs index 3794a8b6c1510..7de690d2d816a 100644 --- a/src/test/ui/or-patterns/struct-like.rs +++ b/src/test/ui/or-patterns/struct-like.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(or_patterns)] - #[derive(Debug)] enum Other { One, diff --git a/src/test/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs b/src/test/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs index ca8826f03f1ad..cffff80eead11 100644 --- a/src/test/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs +++ b/src/test/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs @@ -3,7 +3,6 @@ // run-pass #![feature(bindings_after_at)] -#![feature(or_patterns)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] diff --git a/src/test/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs b/src/test/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs index 65c2b3741b3e3..a99ec0158f02d 100644 --- a/src/test/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs +++ b/src/test/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs @@ -3,7 +3,6 @@ // run-pass #![feature(bindings_after_at)] -#![feature(or_patterns)] #[derive(Debug, PartialEq)] enum MatchArm { diff --git a/src/test/ui/pattern/bindings-after-at/or-patterns.rs b/src/test/ui/pattern/bindings-after-at/or-patterns.rs index a0e14004ab1b0..caf6d91e0011b 100644 --- a/src/test/ui/pattern/bindings-after-at/or-patterns.rs +++ b/src/test/ui/pattern/bindings-after-at/or-patterns.rs @@ -3,7 +3,6 @@ // run-pass #![feature(bindings_after_at)] -#![feature(or_patterns)] #[derive(Debug, PartialEq)] enum MatchArm { diff --git a/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.rs b/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.rs index e8b5b492b7738..09df15f754538 100644 --- a/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.rs +++ b/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.rs @@ -2,7 +2,6 @@ // The code that is tested here lives in resolve (see `resolve_pattern_inner`). #![feature(bindings_after_at)] -#![feature(or_patterns)] fn main() { fn f(a @ a @ a: ()) {} diff --git a/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.stderr b/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.stderr index cba17d82e93c5..77a4937322430 100644 --- a/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.stderr +++ b/src/test/ui/pattern/bindings-after-at/pat-at-same-name-both.stderr @@ -1,59 +1,59 @@ error[E0415]: identifier `a` is bound more than once in this parameter list - --> $DIR/pat-at-same-name-both.rs:8:14 + --> $DIR/pat-at-same-name-both.rs:7:14 | LL | fn f(a @ a @ a: ()) {} | ^ used as parameter more than once error[E0415]: identifier `a` is bound more than once in this parameter list - --> $DIR/pat-at-same-name-both.rs:8:18 + --> $DIR/pat-at-same-name-both.rs:7:18 | LL | fn f(a @ a @ a: ()) {} | ^ used as parameter more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:13:20 + --> $DIR/pat-at-same-name-both.rs:12:20 | LL | Ok(a @ b @ a) | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:15:23 + --> $DIR/pat-at-same-name-both.rs:14:23 | LL | | Err(a @ b @ a) | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:20:13 + --> $DIR/pat-at-same-name-both.rs:19:13 | LL | let a @ a @ a = (); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:20:17 + --> $DIR/pat-at-same-name-both.rs:19:17 | LL | let a @ a @ a = (); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:23:21 + --> $DIR/pat-at-same-name-both.rs:22:21 | LL | let ref a @ ref a = (); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:25:29 + --> $DIR/pat-at-same-name-both.rs:24:29 | LL | let ref mut a @ ref mut a = (); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:28:17 + --> $DIR/pat-at-same-name-both.rs:27:17 | LL | let a @ (Ok(a) | Err(a)) = Ok(()); | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/pat-at-same-name-both.rs:28:26 + --> $DIR/pat-at-same-name-both.rs:27:26 | LL | let a @ (Ok(a) | Err(a)) = Ok(()); | ^ used in a pattern more than once