diff --git a/compiler/rustc_ast/src/lib.rs b/compiler/rustc_ast/src/lib.rs index 4fc7c7475d757..ed78b6d93bcd8 100644 --- a/compiler/rustc_ast/src/lib.rs +++ b/compiler/rustc_ast/src/lib.rs @@ -6,6 +6,7 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc( html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/", test(attr(deny(warnings))) @@ -14,7 +15,6 @@ #![feature(array_windows)] #![feature(associated_type_defaults)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(macro_metavar_expr)] #![feature(negative_impls)] #![feature(never_type)] diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index b99df8bd7e552..ced5bf3bf4c36 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -32,9 +32,10 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(rust_logo)] #![feature(box_patterns)] -#![feature(if_let_guard)] +#![feature(exact_size_is_empty)] #![feature(rustdoc_internals)] // tidy-alphabetical-end diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 3682d25d34147..f0fa4559bb51c 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -454,11 +454,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { } }; } - gate_all!( - if_let_guard, - "`if let` guards are experimental", - "you can write `if matches!(, )` instead of `if let = `" - ); gate_all!(let_chains, "`let` expressions in this position are unstable"); gate_all!( async_trait_bounds, diff --git a/compiler/rustc_ast_passes/src/lib.rs b/compiler/rustc_ast_passes/src/lib.rs index 6517fdb55bd3f..abd897d3ed2ae 100644 --- a/compiler/rustc_ast_passes/src/lib.rs +++ b/compiler/rustc_ast_passes/src/lib.rs @@ -4,9 +4,9 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(rust_logo)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(iter_is_partitioned)] #![feature(rustdoc_internals)] // tidy-alphabetical-end diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index e6eae7d4f5a2e..096cc6905c422 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -2,11 +2,11 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(negative_impls)] #![feature(never_type)] #![feature(rustc_attrs)] diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index 9e7d0ec9e8149..a51ba04802db1 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -5,13 +5,13 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![cfg_attr(not(bootstrap), feature(autodiff))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(decl_macro)] -#![feature(if_let_guard)] #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs index 6890923a59468..9c2de56666b03 100644 --- a/compiler/rustc_codegen_llvm/src/lib.rs +++ b/compiler/rustc_codegen_llvm/src/lib.rs @@ -6,12 +6,12 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(extern_types)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(impl_trait_in_assoc_type)] #![feature(iter_intersperse)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 84919645cf071..44e01eb2cc2bb 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -2,12 +2,12 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(negative_impls)] #![feature(rustdoc_internals)] #![feature(string_from_utf8_lossy_owned)] diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index bf7a79dcb20f0..1ec12cf6d4a66 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -1,11 +1,11 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(decl_macro)] -#![feature(if_let_guard)] #![feature(never_type)] #![feature(rustdoc_internals)] #![feature(slice_ptr_get)] diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 133bd361ee773..6713c94c08cee 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -7,6 +7,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 515d82296caf1..f1fa19049dbfd 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -1,10 +1,10 @@ // tidy-alphabetical-start #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(rust_logo)] #![feature(array_windows)] #![feature(associated_type_defaults)] -#![feature(if_let_guard)] #![feature(macro_metavar_expr)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_internals)] diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index ffa6ffb40b61a..cfe93bbe289bc 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -234,6 +234,8 @@ declare_features! ( (accepted, i128_type, "1.26.0", Some(35118)), /// Allows the use of `if let` expressions. (accepted, if_let, "1.0.0", None), + /// Allows `if let` guard in match arms. + (accepted, if_let_guard, "CURRENT_RUSTC_VERSION", Some(51114)), /// Rescoping temporaries in `if let` to align with Rust 2024. (accepted, if_let_rescope, "1.84.0", Some(124085)), /// Allows top level or-patterns (`p | q`) in `if let` and `while let`. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index b46eac6d8a602..5e67f3020be0f 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -532,8 +532,6 @@ declare_features! ( (incomplete, guard_patterns, "1.85.0", Some(129967)), /// Allows using `..=X` as a patterns in slices. (unstable, half_open_range_patterns_in_slices, "1.66.0", Some(67264)), - /// Allows `if let` guard in match arms. - (unstable, if_let_guard, "1.47.0", Some(51114)), /// Allows `impl Trait` to be used inside associated types (RFC 2515). (unstable, impl_trait_in_assoc_type, "1.70.0", Some(63063)), /// Allows `impl Trait` in bindings (`let`). diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index a92ee89186cf0..191e8b9ab0a3b 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -59,12 +59,12 @@ This API is completely unstable and subject to change. #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(coroutines)] #![feature(debug_closure_helpers)] -#![feature(if_let_guard)] #![feature(iter_from_coroutine)] #![feature(iter_intersperse)] #![feature(never_type)] diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index 741a616631a18..ae735eed37d75 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -1,9 +1,10 @@ // tidy-alphabetical-start #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] +#![feature(array_windows)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(iter_intersperse)] #![feature(never_type)] // tidy-alphabetical-end diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 72bfeaddbf1a7..90d3a2f67efb3 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -21,12 +21,12 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(iter_order_by)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 42d006ef301c6..a5201c5e69497 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -1,6 +1,6 @@ // tidy-alphabetical-start #![allow(rustc::default_hash_types)] -#![feature(if_let_guard)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(never_type)] #![feature(proc_macro_diagnostic)] #![feature(proc_macro_tracked_env)] diff --git a/compiler/rustc_metadata/src/lib.rs b/compiler/rustc_metadata/src/lib.rs index 389a4ab746625..d643fdac46bd5 100644 --- a/compiler/rustc_metadata/src/lib.rs +++ b/compiler/rustc_metadata/src/lib.rs @@ -1,12 +1,12 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(coroutines)] #![feature(decl_macro)] #![feature(error_iter)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(iter_from_coroutine)] #![feature(macro_metavar_expr)] #![feature(min_specialization)] diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 667361b3ca0b8..45d9f4fdee101 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -28,6 +28,7 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(allocator_api)] @@ -44,7 +45,6 @@ #![feature(discriminant_kind)] #![feature(extern_types)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(intra_doc_pointers)] #![feature(iter_from_coroutine)] #![feature(min_specialization)] diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index 8c7003b778761..20fa2f7817846 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -3,9 +3,9 @@ // tidy-alphabetical-start #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(try_blocks)] // tidy-alphabetical-end diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 572ad585c8c87..0e81ae7a2539f 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -1,11 +1,11 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(array_windows)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(const_type_name)] #![feature(cow_is_borrowed)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(impl_trait_in_assoc_type)] #![feature(try_blocks)] #![feature(yeet_expr)] diff --git a/compiler/rustc_monomorphize/src/lib.rs b/compiler/rustc_monomorphize/src/lib.rs index 05683940cba4f..58aaa3763fc3a 100644 --- a/compiler/rustc_monomorphize/src/lib.rs +++ b/compiler/rustc_monomorphize/src/lib.rs @@ -1,7 +1,7 @@ // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(array_windows)] #![feature(file_buffered)] -#![feature(if_let_guard)] #![feature(impl_trait_in_assoc_type)] #![feature(once_cell_get_mut)] // tidy-alphabetical-end diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 8ea535599c94c..85cc6d23a4ce4 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -4,10 +4,10 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(debug_closure_helpers)] -#![feature(if_let_guard)] #![feature(iter_intersperse)] #![recursion_limit = "256"] // tidy-alphabetical-end diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index a298c4d4dec0e..e1acf4538677e 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3423,33 +3423,15 @@ impl<'a> Parser<'a> { } fn parse_match_arm_guard(&mut self) -> PResult<'a, Option>> { - // Used to check the `if_let_guard` feature mostly by scanning - // `&&` tokens. - fn has_let_expr(expr: &Expr) -> bool { - match &expr.kind { - ExprKind::Binary(BinOp { node: BinOpKind::And, .. }, lhs, rhs) => { - let lhs_rslt = has_let_expr(lhs); - let rhs_rslt = has_let_expr(rhs); - lhs_rslt || rhs_rslt - } - ExprKind::Let(..) => true, - _ => false, - } - } if !self.eat_keyword(exp!(If)) { // No match arm guard present. return Ok(None); } - let if_span = self.prev_token.span; let mut cond = self.parse_match_guard_condition()?; CondChecker::new(self, LetChainsPolicy::AlwaysAllowed).visit_expr(&mut cond); - if has_let_expr(&cond) { - let span = if_span.to(cond.span); - self.psess.gated_spans.gate(sym::if_let_guard, span); - } Ok(Some(cond)) } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 9ba70abd4d933..d4e7620df5438 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -10,11 +10,11 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(iter_intersperse)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index ed74dea5f1e63..82d8b6b5d17f3 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -18,12 +18,13 @@ // tidy-alphabetical-start #![allow(internal_features)] #![cfg_attr(bootstrap, feature(cfg_match))] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![cfg_attr(not(bootstrap), feature(cfg_select))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(array_windows)] #![feature(core_io_borrowed_buf)] -#![feature(if_let_guard)] +#![feature(hash_set_entry)] #![feature(map_try_insert)] #![feature(negative_impls)] #![feature(read_buf)] diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index e2b22f7bab744..f46dbea049a86 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -14,12 +14,13 @@ #![allow(internal_features)] #![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::untranslatable_diagnostic)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] -#![feature(if_let_guard)] +#![feature(cfg_version)] #![feature(iter_intersperse)] #![feature(iterator_try_reduce)] #![feature(never_type)] diff --git a/compiler/rustc_ty_utils/src/lib.rs b/compiler/rustc_ty_utils/src/lib.rs index 929cc074bdac7..0125b66ab0e6d 100644 --- a/compiler/rustc_ty_utils/src/lib.rs +++ b/compiler/rustc_ty_utils/src/lib.rs @@ -6,12 +6,12 @@ // tidy-alphabetical-start #![allow(internal_features)] +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(iterator_try_collect)] #![feature(never_type)] #![feature(rustdoc_internals)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index f2a5c40bada0b..0ac5277d2cb1a 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -154,7 +154,6 @@ #![feature(freeze_impls)] #![feature(fundamental)] #![feature(generic_arg_infer)] -#![feature(if_let_guard)] #![feature(intra_doc_pointers)] #![feature(intrinsics)] #![feature(lang_items)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 7c54e731edc62..a0b29e8c699ff 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -295,7 +295,6 @@ #![feature(f16)] #![feature(ffi_const)] #![feature(formatting_options)] -#![feature(if_let_guard)] #![feature(intra_doc_pointers)] #![feature(iter_advance_by)] #![feature(iter_next_chunk)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 025c135aff2a6..3a4db7b74b19f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -1,3 +1,4 @@ +#![cfg_attr(bootstrap, feature(if_let_guard))] #![doc( html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/" @@ -10,7 +11,6 @@ #![feature(debug_closure_helpers)] #![feature(file_buffered)] #![feature(format_args_nl)] -#![feature(if_let_guard)] #![feature(impl_trait_in_assoc_type)] #![feature(iter_intersperse)] #![feature(never_type)] diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 92eb3d7a7c59d..3c1b83dcfd18e 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -1,9 +1,9 @@ +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(array_windows)] #![feature(box_patterns)] #![feature(macro_metavar_expr_concat)] #![feature(f128)] #![feature(f16)] -#![feature(if_let_guard)] #![feature(iter_intersperse)] #![feature(iter_partition_in_place)] #![feature(never_type)] diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index f6ef638e618a4..2e152b171e1c0 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -1,5 +1,5 @@ +#![cfg_attr(bootstrap, feature(if_let_guard))] #![feature(box_patterns)] -#![feature(if_let_guard)] #![feature(macro_metavar_expr)] #![feature(never_type)] #![feature(rustc_private)] diff --git a/src/tools/clippy/tests/ui/redundant_guards.fixed b/src/tools/clippy/tests/ui/redundant_guards.fixed index 9dd9d341db2ef..f433d8263023a 100644 --- a/src/tools/clippy/tests/ui/redundant_guards.fixed +++ b/src/tools/clippy/tests/ui/redundant_guards.fixed @@ -1,5 +1,4 @@ //@aux-build:proc_macros.rs -#![feature(if_let_guard)] #![allow(clippy::no_effect, unused, clippy::single_match, invalid_nan_comparisons)] #![warn(clippy::redundant_guards)] diff --git a/src/tools/clippy/tests/ui/redundant_guards.rs b/src/tools/clippy/tests/ui/redundant_guards.rs index e9950d3bbd1d2..02115af75ed06 100644 --- a/src/tools/clippy/tests/ui/redundant_guards.rs +++ b/src/tools/clippy/tests/ui/redundant_guards.rs @@ -1,5 +1,4 @@ //@aux-build:proc_macros.rs -#![feature(if_let_guard)] #![allow(clippy::no_effect, unused, clippy::single_match, invalid_nan_comparisons)] #![warn(clippy::redundant_guards)] diff --git a/src/tools/clippy/tests/ui/redundant_guards.stderr b/src/tools/clippy/tests/ui/redundant_guards.stderr index cb7b9b119e20f..c889d5a5697d9 100644 --- a/src/tools/clippy/tests/ui/redundant_guards.stderr +++ b/src/tools/clippy/tests/ui/redundant_guards.stderr @@ -1,5 +1,5 @@ error: redundant guard - --> tests/ui/redundant_guards.rs:22:14 + --> tests/ui/redundant_guards.rs:21:14 | LL | x if x == 0.0 => todo!(), | ^^^^^^^^ @@ -13,7 +13,7 @@ LL + 0.0 => todo!(), | error: redundant guard - --> tests/ui/redundant_guards.rs:29:14 + --> tests/ui/redundant_guards.rs:28:14 | LL | x if x == FloatWrapper(0.0) => todo!(), | ^^^^^^^^^^^^^^^^^^^^^^ @@ -25,7 +25,7 @@ LL + FloatWrapper(0.0) => todo!(), | error: redundant guard - --> tests/ui/redundant_guards.rs:45:20 + --> tests/ui/redundant_guards.rs:44:20 | LL | C(x, y) if let 1 = y => .., | ^^^^^^^^^ @@ -37,7 +37,7 @@ LL + C(x, 1) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:52:20 + --> tests/ui/redundant_guards.rs:51:20 | LL | Some(x) if matches!(x, Some(1) if true) => .., | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL + Some(Some(1)) if true => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:54:20 + --> tests/ui/redundant_guards.rs:53:20 | LL | Some(x) if matches!(x, Some(1)) => { | ^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL + Some(Some(1)) => { | error: redundant guard - --> tests/ui/redundant_guards.rs:59:20 + --> tests/ui/redundant_guards.rs:58:20 | LL | Some(x) if let Some(1) = x => .., | ^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL + Some(Some(1)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:61:20 + --> tests/ui/redundant_guards.rs:60:20 | LL | Some(x) if x == Some(2) => .., | ^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL + Some(Some(2)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:63:20 + --> tests/ui/redundant_guards.rs:62:20 | LL | Some(x) if Some(2) == x => .., | ^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL + Some(Some(2)) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:89:20 + --> tests/ui/redundant_guards.rs:88:20 | LL | B { e } if matches!(e, Some(A(2))) => .., | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL + B { e: Some(A(2)) } => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:127:20 + --> tests/ui/redundant_guards.rs:126:20 | LL | E::A(y) if y == "not from an or pattern" => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL + E::A("not from an or pattern") => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:135:14 + --> tests/ui/redundant_guards.rs:134:14 | LL | x if matches!(x, Some(0)) => .., | ^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL + Some(0) => .., | error: redundant guard - --> tests/ui/redundant_guards.rs:143:14 + --> tests/ui/redundant_guards.rs:142:14 | LL | i if i == -1 => {}, | ^^^^^^^ @@ -145,7 +145,7 @@ LL + -1 => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:145:14 + --> tests/ui/redundant_guards.rs:144:14 | LL | i if i == 1 => {}, | ^^^^^^ @@ -157,7 +157,7 @@ LL + 1 => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:208:28 + --> tests/ui/redundant_guards.rs:207:28 | LL | Some(ref x) if x == &1 => {}, | ^^^^^^^ @@ -169,7 +169,7 @@ LL + Some(1) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:210:28 + --> tests/ui/redundant_guards.rs:209:28 | LL | Some(ref x) if &1 == x => {}, | ^^^^^^^ @@ -181,7 +181,7 @@ LL + Some(1) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:212:28 + --> tests/ui/redundant_guards.rs:211:28 | LL | Some(ref x) if let &2 = x => {}, | ^^^^^^^^^^ @@ -193,7 +193,7 @@ LL + Some(2) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:214:28 + --> tests/ui/redundant_guards.rs:213:28 | LL | Some(ref x) if matches!(x, &3) => {}, | ^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL + Some(3) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:235:32 + --> tests/ui/redundant_guards.rs:234:32 | LL | B { ref c, .. } if c == &1 => {}, | ^^^^^^^ @@ -217,7 +217,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:237:32 + --> tests/ui/redundant_guards.rs:236:32 | LL | B { ref c, .. } if &1 == c => {}, | ^^^^^^^ @@ -229,7 +229,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:239:32 + --> tests/ui/redundant_guards.rs:238:32 | LL | B { ref c, .. } if let &1 = c => {}, | ^^^^^^^^^^ @@ -241,7 +241,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:241:32 + --> tests/ui/redundant_guards.rs:240:32 | LL | B { ref c, .. } if matches!(c, &1) => {}, | ^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL + B { c: 1, .. } => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:252:26 + --> tests/ui/redundant_guards.rs:251:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -265,7 +265,7 @@ LL + Some(Some("")) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:264:26 + --> tests/ui/redundant_guards.rs:263:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -277,7 +277,7 @@ LL + Some(Some([])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:270:26 + --> tests/ui/redundant_guards.rs:269:26 | LL | Some(Some(x)) if x.is_empty() => {}, | ^^^^^^^^^^^^ @@ -289,7 +289,7 @@ LL + Some(Some([])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:282:26 + --> tests/ui/redundant_guards.rs:281:26 | LL | Some(Some(x)) if x.starts_with(&[]) => {}, | ^^^^^^^^^^^^^^^^^^ @@ -301,7 +301,7 @@ LL + Some(Some([..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:288:26 + --> tests/ui/redundant_guards.rs:287:26 | LL | Some(Some(x)) if x.starts_with(&[1]) => {}, | ^^^^^^^^^^^^^^^^^^^ @@ -313,7 +313,7 @@ LL + Some(Some([1, ..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:294:26 + --> tests/ui/redundant_guards.rs:293:26 | LL | Some(Some(x)) if x.starts_with(&[1, 2]) => {}, | ^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL + Some(Some([1, 2, ..])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:300:26 + --> tests/ui/redundant_guards.rs:299:26 | LL | Some(Some(x)) if x.ends_with(&[1, 2]) => {}, | ^^^^^^^^^^^^^^^^^^^^ @@ -337,7 +337,7 @@ LL + Some(Some([.., 1, 2])) => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:323:18 + --> tests/ui/redundant_guards.rs:322:18 | LL | y if y.is_empty() => {}, | ^^^^^^^^^^^^ @@ -349,7 +349,7 @@ LL + "" => {}, | error: redundant guard - --> tests/ui/redundant_guards.rs:342:22 + --> tests/ui/redundant_guards.rs:341:22 | LL | y if y.is_empty() => {}, | ^^^^^^^^^^^^ diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed index dc9d6491691f3..376b120dcc260 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.fixed @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![warn(clippy::redundant_pattern_matching)] #![allow( clippy::needless_bool, diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.rs b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.rs index 2e9714ad8e75f..83f9f284df733 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.rs +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.rs @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![warn(clippy::redundant_pattern_matching)] #![allow( clippy::needless_bool, diff --git a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr index e5a6598898aa1..1998278fa9455 100644 --- a/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr +++ b/src/tools/clippy/tests/ui/redundant_pattern_matching_option.stderr @@ -1,5 +1,5 @@ error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:12:5 + --> tests/ui/redundant_pattern_matching_option.rs:11:5 | LL | matches!(maybe_some, None if !boolean) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (!boolean)` @@ -8,55 +8,55 @@ LL | matches!(maybe_some, None if !boolean) = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:17:13 + --> tests/ui/redundant_pattern_matching_option.rs:16:13 | LL | let _ = matches!(maybe_some, None if boolean || boolean2); // guard needs parentheses | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (boolean || boolean2)` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:33:12 + --> tests/ui/redundant_pattern_matching_option.rs:32:12 | LL | if let None = None::<()> {} | -------^^^^------------- help: try: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:36:12 + --> tests/ui/redundant_pattern_matching_option.rs:35:12 | LL | if let Some(_) = Some(42) {} | -------^^^^^^^----------- help: try: `if Some(42).is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:39:12 + --> tests/ui/redundant_pattern_matching_option.rs:38:12 | LL | if let Some(_) = Some(42) { | -------^^^^^^^----------- help: try: `if Some(42).is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:46:15 + --> tests/ui/redundant_pattern_matching_option.rs:45:15 | LL | while let Some(_) = Some(42) {} | ----------^^^^^^^----------- help: try: `while Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:49:15 + --> tests/ui/redundant_pattern_matching_option.rs:48:15 | LL | while let None = Some(42) {} | ----------^^^^----------- help: try: `while Some(42).is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:52:15 + --> tests/ui/redundant_pattern_matching_option.rs:51:15 | LL | while let None = None::<()> {} | ----------^^^^------------- help: try: `while None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:56:15 + --> tests/ui/redundant_pattern_matching_option.rs:55:15 | LL | while let Some(_) = v.pop() { | ----------^^^^^^^---------- help: try: `while v.pop().is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:65:5 + --> tests/ui/redundant_pattern_matching_option.rs:64:5 | LL | / match Some(42) { LL | | @@ -66,7 +66,7 @@ LL | | }; | |_____^ help: try: `Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:71:5 + --> tests/ui/redundant_pattern_matching_option.rs:70:5 | LL | / match None::<()> { LL | | @@ -76,7 +76,7 @@ LL | | }; | |_____^ help: try: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:77:13 + --> tests/ui/redundant_pattern_matching_option.rs:76:13 | LL | let _ = match None::<()> { | _____________^ @@ -87,55 +87,55 @@ LL | | }; | |_____^ help: try: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:84:20 + --> tests/ui/redundant_pattern_matching_option.rs:83:20 | LL | let _ = if let Some(_) = opt { true } else { false }; | -------^^^^^^^------ help: try: `if opt.is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:91:20 + --> tests/ui/redundant_pattern_matching_option.rs:90:20 | LL | let _ = if let Some(_) = gen_opt() { | -------^^^^^^^------------ help: try: `if gen_opt().is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:94:19 + --> tests/ui/redundant_pattern_matching_option.rs:93:19 | LL | } else if let None = gen_opt() { | -------^^^^------------ help: try: `if gen_opt().is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:101:12 + --> tests/ui/redundant_pattern_matching_option.rs:100:12 | LL | if let Some(..) = gen_opt() {} | -------^^^^^^^^------------ help: try: `if gen_opt().is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:117:12 + --> tests/ui/redundant_pattern_matching_option.rs:116:12 | LL | if let Some(_) = Some(42) {} | -------^^^^^^^----------- help: try: `if Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:120:12 + --> tests/ui/redundant_pattern_matching_option.rs:119:12 | LL | if let None = None::<()> {} | -------^^^^------------- help: try: `if None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:123:15 + --> tests/ui/redundant_pattern_matching_option.rs:122:15 | LL | while let Some(_) = Some(42) {} | ----------^^^^^^^----------- help: try: `while Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:126:15 + --> tests/ui/redundant_pattern_matching_option.rs:125:15 | LL | while let None = None::<()> {} | ----------^^^^------------- help: try: `while None::<()>.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:129:5 + --> tests/ui/redundant_pattern_matching_option.rs:128:5 | LL | / match Some(42) { LL | | @@ -145,7 +145,7 @@ LL | | }; | |_____^ help: try: `Some(42).is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:135:5 + --> tests/ui/redundant_pattern_matching_option.rs:134:5 | LL | / match None::<()> { LL | | @@ -155,19 +155,19 @@ LL | | }; | |_____^ help: try: `None::<()>.is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:144:12 + --> tests/ui/redundant_pattern_matching_option.rs:143:12 | LL | if let None = *(&None::<()>) {} | -------^^^^----------------- help: try: `if (&None::<()>).is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:146:12 + --> tests/ui/redundant_pattern_matching_option.rs:145:12 | LL | if let None = *&None::<()> {} | -------^^^^--------------- help: try: `if (&None::<()>).is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:153:5 + --> tests/ui/redundant_pattern_matching_option.rs:152:5 | LL | / match x { LL | | @@ -177,7 +177,7 @@ LL | | }; | |_____^ help: try: `x.is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:159:5 + --> tests/ui/redundant_pattern_matching_option.rs:158:5 | LL | / match x { LL | | @@ -187,7 +187,7 @@ LL | | }; | |_____^ help: try: `x.is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:165:5 + --> tests/ui/redundant_pattern_matching_option.rs:164:5 | LL | / match x { LL | | @@ -197,7 +197,7 @@ LL | | }; | |_____^ help: try: `x.is_none()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:171:5 + --> tests/ui/redundant_pattern_matching_option.rs:170:5 | LL | / match x { LL | | @@ -207,19 +207,19 @@ LL | | }; | |_____^ help: try: `x.is_some()` error: redundant pattern matching, consider using `is_some()` - --> tests/ui/redundant_pattern_matching_option.rs:187:13 + --> tests/ui/redundant_pattern_matching_option.rs:186:13 | LL | let _ = matches!(x, Some(_)); | ^^^^^^^^^^^^^^^^^^^^ help: try: `x.is_some()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:190:13 + --> tests/ui/redundant_pattern_matching_option.rs:189:13 | LL | let _ = matches!(x, None); | ^^^^^^^^^^^^^^^^^ help: try: `x.is_none()` error: redundant pattern matching, consider using `is_none()` - --> tests/ui/redundant_pattern_matching_option.rs:201:17 + --> tests/ui/redundant_pattern_matching_option.rs:200:17 | LL | let _ = matches!(*p, None); | ^^^^^^^^^^^^^^^^^^ help: try: `(*p).is_none()` diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 3e9d79224fdde..86401a558f3ef 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -3659,7 +3659,6 @@ ui/rfcs/rfc-2396-target_feature-11/issue-99876.rs ui/rfcs/rfc-2497-if-let-chains/issue-88498.rs ui/rfcs/rfc-2497-if-let-chains/issue-90722.rs ui/rfcs/rfc-2497-if-let-chains/issue-92145.rs -ui/rfcs/rfc-2497-if-let-chains/issue-93150.rs ui/rfcs/rfc-2497-if-let-chains/issue-99938.rs ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs ui/rfcs/rfc-2528-type-changing-struct-update/issue-96878.rs diff --git a/tests/ui/async-await/issues/issue-66695-static-refs.rs b/tests/ui/async-await/issues/issue-66695-static-refs.rs index 5bf92f966f429..aafdca8327e87 100644 --- a/tests/ui/async-await/issues/issue-66695-static-refs.rs +++ b/tests/ui/async-await/issues/issue-66695-static-refs.rs @@ -1,7 +1,6 @@ //@ build-pass //@ edition:2018 -#![feature(if_let_guard)] static A: [i32; 5] = [1, 2, 3, 4, 5]; diff --git a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs index 547c7414526c2..04958352d3f2e 100644 --- a/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs +++ b/tests/ui/async-await/issues/issue-67611-static-mut-refs.rs @@ -1,7 +1,6 @@ //@ build-pass //@ edition:2018 -#![feature(if_let_guard)] // FIXME(static_mut_refs): Do not allow `static_mut_refs` lint #![allow(static_mut_refs)] diff --git a/tests/ui/async-await/missed-capture-issue-107414.rs b/tests/ui/async-await/missed-capture-issue-107414.rs index 0249fd9bbb0f2..ed5ae80c8f74d 100644 --- a/tests/ui/async-await/missed-capture-issue-107414.rs +++ b/tests/ui/async-await/missed-capture-issue-107414.rs @@ -1,7 +1,6 @@ //@ check-pass //@ edition:2018 -#![feature(if_let_guard)] fn main() {} diff --git a/tests/ui/binding/match-beginning-vert.rs b/tests/ui/binding/match-beginning-vert.rs index ac07181e06330..6128dfa23531d 100644 --- a/tests/ui/binding/match-beginning-vert.rs +++ b/tests/ui/binding/match-beginning-vert.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(if_let_guard)] - enum Foo { A, B, diff --git a/tests/ui/borrowck/borrowck-drop-from-guard.rs b/tests/ui/borrowck/borrowck-drop-from-guard.rs index 0f320af265760..6d1b4a7a3f5bc 100644 --- a/tests/ui/borrowck/borrowck-drop-from-guard.rs +++ b/tests/ui/borrowck/borrowck-drop-from-guard.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - fn foo(_:String) {} fn main() diff --git a/tests/ui/borrowck/borrowck-drop-from-guard.stderr b/tests/ui/borrowck/borrowck-drop-from-guard.stderr index 9fa28efd8554d..b14a00df9815f 100644 --- a/tests/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/tests/ui/borrowck/borrowck-drop-from-guard.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `my_str` - --> $DIR/borrowck-drop-from-guard.rs:11:23 + --> $DIR/borrowck-drop-from-guard.rs:9:23 | LL | let my_str = "hello".to_owned(); | ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait @@ -16,7 +16,7 @@ LL | Some(_) if { drop(my_str.clone()); false } => {} | ++++++++ error[E0382]: use of moved value: `my_str` - --> $DIR/borrowck-drop-from-guard.rs:18:23 + --> $DIR/borrowck-drop-from-guard.rs:16:23 | LL | let my_str = "hello".to_owned(); | ------ move occurs because `my_str` has type `String`, which does not implement the `Copy` trait diff --git a/tests/ui/borrowck/borrowck-mutate-in-guard.rs b/tests/ui/borrowck/borrowck-mutate-in-guard.rs index d80a9e81576f4..3295229bd0479 100644 --- a/tests/ui/borrowck/borrowck-mutate-in-guard.rs +++ b/tests/ui/borrowck/borrowck-mutate-in-guard.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - enum Enum<'a> { A(&'a isize), B(bool), diff --git a/tests/ui/borrowck/borrowck-mutate-in-guard.stderr b/tests/ui/borrowck/borrowck-mutate-in-guard.stderr index dbb3272fdc351..797827141272c 100644 --- a/tests/ui/borrowck/borrowck-mutate-in-guard.stderr +++ b/tests/ui/borrowck/borrowck-mutate-in-guard.stderr @@ -1,5 +1,5 @@ error[E0510]: cannot assign `x` in match guard - --> $DIR/borrowck-mutate-in-guard.rs:12:25 + --> $DIR/borrowck-mutate-in-guard.rs:10:25 | LL | match x { | - value is immutable in match guard @@ -7,7 +7,7 @@ LL | Enum::A(_) if { x = Enum::B(false); false } => 1, | ^^^^^^^^^^^^^^^^^^ cannot assign error[E0510]: cannot mutably borrow `x` in match guard - --> $DIR/borrowck-mutate-in-guard.rs:14:33 + --> $DIR/borrowck-mutate-in-guard.rs:12:33 | LL | match x { | - value is immutable in match guard @@ -16,7 +16,7 @@ LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ^^^^^^ cannot mutably borrow error[E0510]: cannot assign `x` in match guard - --> $DIR/borrowck-mutate-in-guard.rs:25:40 + --> $DIR/borrowck-mutate-in-guard.rs:23:40 | LL | match x { | - value is immutable in match guard @@ -24,7 +24,7 @@ LL | Enum::A(_) if let Some(()) = { x = Enum::B(false); None } => 1, | ^^^^^^^^^^^^^^^^^^ cannot assign error[E0510]: cannot mutably borrow `x` in match guard - --> $DIR/borrowck-mutate-in-guard.rs:27:48 + --> $DIR/borrowck-mutate-in-guard.rs:25:48 | LL | match x { | - value is immutable in match guard diff --git a/tests/ui/borrowck/issue-31287-drop-in-guard.rs b/tests/ui/borrowck/issue-31287-drop-in-guard.rs index 5b824adc6e273..fff181597d944 100644 --- a/tests/ui/borrowck/issue-31287-drop-in-guard.rs +++ b/tests/ui/borrowck/issue-31287-drop-in-guard.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - fn main() { let a = Some("...".to_owned()); let b = match a { diff --git a/tests/ui/borrowck/issue-31287-drop-in-guard.stderr b/tests/ui/borrowck/issue-31287-drop-in-guard.stderr index 18f371c20735a..f61bca650a4b3 100644 --- a/tests/ui/borrowck/issue-31287-drop-in-guard.stderr +++ b/tests/ui/borrowck/issue-31287-drop-in-guard.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a` - --> $DIR/issue-31287-drop-in-guard.rs:7:9 + --> $DIR/issue-31287-drop-in-guard.rs:5:9 | LL | let a = Some("...".to_owned()); | - move occurs because `a` has type `Option`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ LL | Some(_) if { drop(a.clone()); false } => None, | ++++++++ error[E0382]: use of moved value: `a` - --> $DIR/issue-31287-drop-in-guard.rs:13:9 + --> $DIR/issue-31287-drop-in-guard.rs:11:9 | LL | let a = Some("...".to_owned()); | - move occurs because `a` has type `Option`, which does not implement the `Copy` trait diff --git a/tests/ui/closures/2229_closure_analysis/issue-88118-2.rs b/tests/ui/closures/2229_closure_analysis/issue-88118-2.rs index 27c1eac88e573..f8583da30463a 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88118-2.rs +++ b/tests/ui/closures/2229_closure_analysis/issue-88118-2.rs @@ -1,6 +1,5 @@ //@ edition:2021 //@ run-pass -#![feature(if_let_guard)] #[allow(unused_must_use)] #[allow(dead_code)] diff --git a/tests/ui/closures/2229_closure_analysis/issue-88118-2.stderr b/tests/ui/closures/2229_closure_analysis/issue-88118-2.stderr index 34b3eab2345bd..f8141a595850b 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-88118-2.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-88118-2.stderr @@ -1,5 +1,5 @@ warning: irrefutable `if let` guard pattern - --> $DIR/issue-88118-2.rs:10:25 + --> $DIR/issue-88118-2.rs:9:25 | LL | Registry if let _ = registry.try_find_description() => { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr index 394629c000136..66e651661e4fb 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `value` because it is borrowed - --> $DIR/if-let-guards-errors.rs:16:13 + --> $DIR/if-let-guards-errors.rs:15:13 | LL | let f = |x: &E| { | ------- borrow of `value` occurs here @@ -14,7 +14,7 @@ LL | drop(f); | - borrow later used here error[E0382]: use of moved value: `value` - --> $DIR/if-let-guards-errors.rs:28:13 + --> $DIR/if-let-guards-errors.rs:27:13 | LL | fn if_let_move(value: Box) { | ----- move occurs because `value` has type `Box`, which does not implement the `Copy` trait diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr index 5672845019b8f..00e501a29fb79 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `value` because it is borrowed - --> $DIR/if-let-guards-errors.rs:16:13 + --> $DIR/if-let-guards-errors.rs:15:13 | LL | let f = |x: &E| { | ------- borrow of `*value` occurs here @@ -14,7 +14,7 @@ LL | drop(f); | - borrow later used here error[E0382]: use of moved value: `value` - --> $DIR/if-let-guards-errors.rs:28:13 + --> $DIR/if-let-guards-errors.rs:27:13 | LL | fn if_let_move(value: Box) { | ----- move occurs because `value` has type `Box`, which does not implement the `Copy` trait diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs index e19838995eecc..d2bc20ba766f5 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.rs @@ -3,7 +3,6 @@ //@[e2018] edition:2018 //@[e2021] edition:2021 -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] fn if_let_ref_mut(mut value: Box) { diff --git a/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs index a629a91bb9062..612a32f35fd52 100644 --- a/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs +++ b/tests/ui/closures/2229_closure_analysis/match/if-let-guards.rs @@ -4,7 +4,6 @@ //@[e2018] edition:2018 //@[e2021] edition:2021 -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] fn if_let_underscore(value: Box) { diff --git a/tests/ui/coroutine/yielding-in-match-guards.rs b/tests/ui/coroutine/yielding-in-match-guards.rs index 6f074188728ef..39e85077c02f9 100644 --- a/tests/ui/coroutine/yielding-in-match-guards.rs +++ b/tests/ui/coroutine/yielding-in-match-guards.rs @@ -10,7 +10,6 @@ // Thus, `&'_ u8` should be included in type signature // of the underlying coroutine. -#![feature(if_let_guard)] async fn f() -> u8 { 1 } async fn foo() -> [bool; 10] { [false; 10] } diff --git a/tests/ui/drop/drop-order-comparisons.e2021.fixed b/tests/ui/drop/drop-order-comparisons.e2021.fixed index 42f805923ec22..0660f5125eda0 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.fixed +++ b/tests/ui/drop/drop-order-comparisons.e2021.fixed @@ -24,7 +24,6 @@ //@ [e2024] edition: 2024 //@ run-pass -#![feature(if_let_guard)] #![cfg_attr(e2021, feature(let_chains))] #![cfg_attr(e2021, warn(rust_2024_compatibility))] diff --git a/tests/ui/drop/drop-order-comparisons.e2021.stderr b/tests/ui/drop/drop-order-comparisons.e2021.stderr index 8b93376cc0d05..a286f7e97a2e7 100644 --- a/tests/ui/drop/drop-order-comparisons.e2021.stderr +++ b/tests/ui/drop/drop-order-comparisons.e2021.stderr @@ -1,5 +1,5 @@ warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:77:9 + --> $DIR/drop-order-comparisons.rs:76:9 | LL | _ = ({ | _________- @@ -29,35 +29,35 @@ LL | | }, e.mark(3), e.ok(4)); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#3` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `_v` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here - --> $DIR/drop-order-comparisons.rs:29:25 + --> $DIR/drop-order-comparisons.rs:28:25 | LL | #![cfg_attr(e2021, warn(rust_2024_compatibility))] | ^^^^^^^^^^^^^^^^^^^^^^^ = note: `#[warn(tail_expr_drop_order)]` implied by `#[warn(rust_2024_compatibility)]` warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:101:45 + --> $DIR/drop-order-comparisons.rs:100:45 | LL | _ = ({ | _________- @@ -77,19 +77,19 @@ LL | | }, e.mark(1), e.ok(4)); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:101:19 + --> $DIR/drop-order-comparisons.rs:100:19 | LL | _ = ({ | _________- @@ -109,19 +109,19 @@ LL | | }, e.mark(1), e.ok(4)); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:222:24 + --> $DIR/drop-order-comparisons.rs:221:24 | LL | _ = ({ | _________- @@ -141,19 +141,19 @@ LL | | }, e.mark(2), e.ok(3)); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: relative drop order changing in Rust 2024 - --> $DIR/drop-order-comparisons.rs:248:24 + --> $DIR/drop-order-comparisons.rs:247:24 | LL | _ = ({ | _________- @@ -173,19 +173,19 @@ LL | | }, e.mark(2), e.ok(3)); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#2` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `#1` invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:124:13 + --> $DIR/drop-order-comparisons.rs:123:13 | LL | _ = (if let Ok(_) = e.ok(4).as_ref() { | ^^^^^^^^^^^^-------^^^^^^^^^ @@ -195,12 +195,12 @@ LL | _ = (if let Ok(_) = e.ok(4).as_ref() { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:128:5 + --> $DIR/drop-order-comparisons.rs:127:5 | LL | }, e.mark(2), e.ok(3)); | ^ @@ -215,7 +215,7 @@ LL ~ } _ => {}}, e.mark(2), e.ok(3)); | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:146:13 + --> $DIR/drop-order-comparisons.rs:145:13 | LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -225,12 +225,12 @@ LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:146:44 + --> $DIR/drop-order-comparisons.rs:145:44 | LL | _ = (if let Ok(_) = e.err(4).as_ref() {} else { | ^ @@ -244,7 +244,7 @@ LL ~ }}, e.mark(2), e.ok(3)); | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:248:12 + --> $DIR/drop-order-comparisons.rs:247:12 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -254,12 +254,12 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:248:43 + --> $DIR/drop-order-comparisons.rs:247:43 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^ @@ -273,7 +273,7 @@ LL ~ }} | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:372:12 + --> $DIR/drop-order-comparisons.rs:371:12 | LL | if let true = e.err(9).is_ok() {} else { | ^^^^^^^^^^^--------^^^^^^^^ @@ -283,12 +283,12 @@ LL | if let true = e.err(9).is_ok() {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:372:41 + --> $DIR/drop-order-comparisons.rs:371:41 | LL | if let true = e.err(9).is_ok() {} else { | ^ @@ -302,7 +302,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:375:12 + --> $DIR/drop-order-comparisons.rs:374:12 | LL | if let Ok(_v) = e.err(8) {} else { | ^^^^^^^^^^^^^-------- @@ -312,12 +312,12 @@ LL | if let Ok(_v) = e.err(8) {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:375:35 + --> $DIR/drop-order-comparisons.rs:374:35 | LL | if let Ok(_v) = e.err(8) {} else { | ^ @@ -331,7 +331,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:378:12 + --> $DIR/drop-order-comparisons.rs:377:12 | LL | if let Ok(_) = e.err(7) {} else { | ^^^^^^^^^^^^-------- @@ -341,12 +341,12 @@ LL | if let Ok(_) = e.err(7) {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:378:34 + --> $DIR/drop-order-comparisons.rs:377:34 | LL | if let Ok(_) = e.err(7) {} else { | ^ @@ -360,7 +360,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:381:12 + --> $DIR/drop-order-comparisons.rs:380:12 | LL | if let Ok(_) = e.err(6).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -370,12 +370,12 @@ LL | if let Ok(_) = e.err(6).as_ref() {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:381:43 + --> $DIR/drop-order-comparisons.rs:380:43 | LL | if let Ok(_) = e.err(6).as_ref() {} else { | ^ @@ -389,7 +389,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:385:12 + --> $DIR/drop-order-comparisons.rs:384:12 | LL | if let Ok(_v) = e.err(5) {} else { | ^^^^^^^^^^^^^-------- @@ -399,12 +399,12 @@ LL | if let Ok(_v) = e.err(5) {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:385:35 + --> $DIR/drop-order-comparisons.rs:384:35 | LL | if let Ok(_v) = e.err(5) {} else { | ^ @@ -418,7 +418,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:388:12 + --> $DIR/drop-order-comparisons.rs:387:12 | LL | if let Ok(_) = e.err(4) {} else { | ^^^^^^^^^^^^-------- @@ -428,12 +428,12 @@ LL | if let Ok(_) = e.err(4) {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:388:34 + --> $DIR/drop-order-comparisons.rs:387:34 | LL | if let Ok(_) = e.err(4) {} else { | ^ @@ -447,7 +447,7 @@ LL ~ }}}}}}}}}; | warning: `if let` assigns a shorter lifetime since Edition 2024 - --> $DIR/drop-order-comparisons.rs:424:12 + --> $DIR/drop-order-comparisons.rs:423:12 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^^^^^^^^^^^^--------^^^^^^^^^ @@ -457,12 +457,12 @@ LL | if let Ok(_) = e.err(4).as_ref() {} else { = warning: this changes meaning in Rust 2024 = note: for more information, see note: value invokes this custom destructor - --> $DIR/drop-order-comparisons.rs:612:1 + --> $DIR/drop-order-comparisons.rs:611:1 | LL | impl<'b> Drop for LogDrop<'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: the value is now dropped here in Edition 2024 - --> $DIR/drop-order-comparisons.rs:424:43 + --> $DIR/drop-order-comparisons.rs:423:43 | LL | if let Ok(_) = e.err(4).as_ref() {} else { | ^ diff --git a/tests/ui/drop/drop-order-comparisons.rs b/tests/ui/drop/drop-order-comparisons.rs index e7425159aa23a..231be2047c2a4 100644 --- a/tests/ui/drop/drop-order-comparisons.rs +++ b/tests/ui/drop/drop-order-comparisons.rs @@ -24,7 +24,6 @@ //@ [e2024] edition: 2024 //@ run-pass -#![feature(if_let_guard)] #![cfg_attr(e2021, feature(let_chains))] #![cfg_attr(e2021, warn(rust_2024_compatibility))] diff --git a/tests/ui/drop/dynamic-drop.rs b/tests/ui/drop/dynamic-drop.rs index b695b5702d943..5cad16c748164 100644 --- a/tests/ui/drop/dynamic-drop.rs +++ b/tests/ui/drop/dynamic-drop.rs @@ -2,7 +2,6 @@ //@ needs-unwind #![feature(coroutines, coroutine_trait, stmt_expr_attributes)] -#![feature(if_let_guard)] #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/tests/ui/issues/issue-29723.rs b/tests/ui/issues/issue-29723.rs index 399e9ba0df730..790a446c66e8f 100644 --- a/tests/ui/issues/issue-29723.rs +++ b/tests/ui/issues/issue-29723.rs @@ -1,7 +1,5 @@ // test for https://github.com/rust-lang/rust/issues/29723 -#![feature(if_let_guard)] - fn main() { let s = String::new(); let _s = match 0 { diff --git a/tests/ui/issues/issue-29723.stderr b/tests/ui/issues/issue-29723.stderr index 044d8a9b5dd1d..6a4a8fc453eda 100644 --- a/tests/ui/issues/issue-29723.stderr +++ b/tests/ui/issues/issue-29723.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `s` - --> $DIR/issue-29723.rs:12:13 + --> $DIR/issue-29723.rs:10:13 | LL | let s = String::new(); | - move occurs because `s` has type `String`, which does not implement the `Copy` trait @@ -16,7 +16,7 @@ LL | 0 if { drop(s.clone()); false } => String::from("oops"), | ++++++++ error[E0382]: use of moved value: `s` - --> $DIR/issue-29723.rs:20:14 + --> $DIR/issue-29723.rs:18:14 | LL | let s = String::new(); | - move occurs because `s` has type `String`, which does not implement the `Copy` trait diff --git a/tests/ui/lint/lint-match-arms-2.rs b/tests/ui/lint/lint-match-arms-2.rs index 0c1146339c45f..d8d52c130759f 100644 --- a/tests/ui/lint/lint-match-arms-2.rs +++ b/tests/ui/lint/lint-match-arms-2.rs @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![allow(unused, non_snake_case)] enum E { diff --git a/tests/ui/lint/lint-match-arms-2.stderr b/tests/ui/lint/lint-match-arms-2.stderr index 5e803ef193480..b308a9ee4ef38 100644 --- a/tests/ui/lint/lint-match-arms-2.stderr +++ b/tests/ui/lint/lint-match-arms-2.stderr @@ -1,17 +1,17 @@ error[E0170]: pattern binding `A` is named the same as one of the variants of the type `E` - --> $DIR/lint-match-arms-2.rs:12:9 + --> $DIR/lint-match-arms-2.rs:11:9 | LL | A => {} | ^ help: to match on the variant, qualify the path: `E::A` | note: the lint level is defined here - --> $DIR/lint-match-arms-2.rs:11:16 + --> $DIR/lint-match-arms-2.rs:10:16 | LL | #[deny(bindings_with_variant_name)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: irrefutable `if let` guard pattern - --> $DIR/lint-match-arms-2.rs:18:14 + --> $DIR/lint-match-arms-2.rs:17:14 | LL | a if let b = a => {} | ^^^^^^^^^ @@ -19,7 +19,7 @@ LL | a if let b = a => {} = note: this pattern will always match, so the guard is useless = help: consider removing the guard and adding a `let` inside the match arm note: the lint level is defined here - --> $DIR/lint-match-arms-2.rs:17:16 + --> $DIR/lint-match-arms-2.rs:16:16 | LL | #[deny(irrefutable_let_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/unused/issue-119383-if-let-guard.rs b/tests/ui/lint/unused/issue-119383-if-let-guard.rs index 71197444f45c3..7c54ce5e61912 100644 --- a/tests/ui/lint/unused/issue-119383-if-let-guard.rs +++ b/tests/ui/lint/unused/issue-119383-if-let-guard.rs @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![deny(unused_variables)] fn main() { diff --git a/tests/ui/lint/unused/issue-119383-if-let-guard.stderr b/tests/ui/lint/unused/issue-119383-if-let-guard.stderr index 5bf48bb80a8f6..f95b3193e57cf 100644 --- a/tests/ui/lint/unused/issue-119383-if-let-guard.stderr +++ b/tests/ui/lint/unused/issue-119383-if-let-guard.stderr @@ -1,11 +1,11 @@ error: unused variable: `b` - --> $DIR/issue-119383-if-let-guard.rs:6:24 + --> $DIR/issue-119383-if-let-guard.rs:5:24 | LL | () if let Some(b) = Some(()) => {} | ^ help: if this is intentional, prefix it with an underscore: `_b` | note: the lint level is defined here - --> $DIR/issue-119383-if-let-guard.rs:2:9 + --> $DIR/issue-119383-if-let-guard.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 3f3d9252adbe8..46312250cc37a 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -9,7 +9,6 @@ #![feature(coroutines)] #![feature(decl_macro)] #![feature(explicit_tail_calls)] -#![feature(if_let_guard)] #![feature(let_chains)] #![feature(more_qualified_paths)] #![feature(never_patterns)] diff --git a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs index e98d57d1154c4..9c1eaf0fac635 100644 --- a/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs +++ b/tests/ui/mir/mir_match_guard_let_chains_drop_order.rs @@ -6,7 +6,6 @@ // See `mir_drop_order.rs` for more information -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] use std::cell::RefCell; diff --git a/tests/ui/nll/issue-24535-allow-mutable-borrow-in-match-guard.rs b/tests/ui/nll/issue-24535-allow-mutable-borrow-in-match-guard.rs index 4e4278820f1af..ee9c5c15a55e5 100644 --- a/tests/ui/nll/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ b/tests/ui/nll/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -5,8 +5,6 @@ // See further discussion on rust-lang/rust#24535, // rust-lang/rfcs#1006, and rust-lang/rfcs#107 -#![feature(if_let_guard)] - fn main() { rust_issue_24535(); rfcs_issue_1006_1(); diff --git a/tests/ui/nll/issue-27282-move-match-input-into-guard.rs b/tests/ui/nll/issue-27282-move-match-input-into-guard.rs index 85feda5824b40..2650fd560a652 100644 --- a/tests/ui/nll/issue-27282-move-match-input-into-guard.rs +++ b/tests/ui/nll/issue-27282-move-match-input-into-guard.rs @@ -7,8 +7,6 @@ // reaches the panic code when executed, despite the compiler warning // about that match arm being unreachable. -#![feature(if_let_guard)] - fn main() { let b = &mut true; match b { diff --git a/tests/ui/nll/issue-27282-move-match-input-into-guard.stderr b/tests/ui/nll/issue-27282-move-match-input-into-guard.stderr index ae7978004576b..4df53c0673f2c 100644 --- a/tests/ui/nll/issue-27282-move-match-input-into-guard.stderr +++ b/tests/ui/nll/issue-27282-move-match-input-into-guard.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `b` - --> $DIR/issue-27282-move-match-input-into-guard.rs:14:5 + --> $DIR/issue-27282-move-match-input-into-guard.rs:12:5 | LL | let b = &mut true; | - move occurs because `b` has type `&mut bool`, which does not implement the `Copy` trait @@ -12,7 +12,7 @@ LL | _ if { (|| { let bar = b; *bar = false; })(); | value moved into closure here error[E0382]: use of moved value: `b` - --> $DIR/issue-27282-move-match-input-into-guard.rs:24:5 + --> $DIR/issue-27282-move-match-input-into-guard.rs:22:5 | LL | let b = &mut true; | - move occurs because `b` has type `&mut bool`, which does not implement the `Copy` trait diff --git a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.rs b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.rs index c3b19886a5078..5af258c3a6c36 100644 --- a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.rs +++ b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.rs @@ -2,8 +2,6 @@ // mutable borrows in match guards by hiding the mutable borrow in a // guard behind a move (of the ref mut pattern id) within a closure. -#![feature(if_let_guard)] - fn main() { match Some(&4) { None => {}, diff --git a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr index e790fda4d7ca7..0f1f2b83c42d1 100644 --- a/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr +++ b/tests/ui/nll/issue-27282-move-ref-mut-into-guard.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/issue-27282-move-ref-mut-into-guard.rs:11:19 + --> $DIR/issue-27282-move-ref-mut-into-guard.rs:9:19 | LL | if { (|| { let mut bar = foo; bar.take() })(); false } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | if { (|| { let mut bar = foo; bar.take() })(); false } => {}, = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/issue-27282-move-ref-mut-into-guard.rs:19:34 + --> $DIR/issue-27282-move-ref-mut-into-guard.rs:17:34 | LL | if let Some(()) = { (|| { let mut bar = foo; bar.take() })(); None } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait diff --git a/tests/ui/nll/issue-27282-mutation-in-guard.rs b/tests/ui/nll/issue-27282-mutation-in-guard.rs index 4f41fc23fc34b..a37b4f3fc1468 100644 --- a/tests/ui/nll/issue-27282-mutation-in-guard.rs +++ b/tests/ui/nll/issue-27282-mutation-in-guard.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - fn main() { match Some(&4) { None => {}, diff --git a/tests/ui/nll/issue-27282-mutation-in-guard.stderr b/tests/ui/nll/issue-27282-mutation-in-guard.stderr index 0b5d723172c76..bd531eb6d0199 100644 --- a/tests/ui/nll/issue-27282-mutation-in-guard.stderr +++ b/tests/ui/nll/issue-27282-mutation-in-guard.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/issue-27282-mutation-in-guard.rs:8:18 + --> $DIR/issue-27282-mutation-in-guard.rs:6:18 | LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | (|| { let bar = foo; bar.take() })(); = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/issue-27282-mutation-in-guard.rs:20:18 + --> $DIR/issue-27282-mutation-in-guard.rs:18:18 | LL | (|| { let bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait diff --git a/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs b/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs index ac06b2b01028f..4311c9eec2d55 100644 --- a/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs +++ b/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.rs @@ -5,8 +5,6 @@ // reject it. But I want to make sure that we continue to reject it // (under NLL) even when that conservative check goes away. -#![feature(if_let_guard)] - fn main() { let mut b = &mut true; match b { diff --git a/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr b/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr index 5eb7a25bf9f50..ed66634ed054c 100644 --- a/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr +++ b/tests/ui/nll/issue-27282-reborrow-ref-mut-in-guard.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard - --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:14:25 + --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:12:25 | LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })(); | ^^ -- mutable borrow occurs due to use of `r` in closure @@ -9,7 +9,7 @@ LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })(); = note: variables bound in patterns are immutable until the end of the pattern guard error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard - --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:24:40 + --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:22:40 | LL | ref mut r if let Some(()) = { (|| { let bar = &mut *r; **bar = false; })(); | ^^ -- mutable borrow occurs due to use of `r` in closure diff --git a/tests/ui/nll/match-cfg-fake-edges.rs b/tests/ui/nll/match-cfg-fake-edges.rs index e349c2c8e2a5f..1bd9156b06d43 100644 --- a/tests/ui/nll/match-cfg-fake-edges.rs +++ b/tests/ui/nll/match-cfg-fake-edges.rs @@ -1,8 +1,6 @@ // Test that we have enough false edges to avoid exposing the exact matching // algorithm in borrow checking. -#![feature(if_let_guard)] - #[rustfmt::skip] fn all_patterns_are_tested() { // Even though `x` is never actually moved out of, we don't want borrowck results to be based on diff --git a/tests/ui/nll/match-cfg-fake-edges.stderr b/tests/ui/nll/match-cfg-fake-edges.stderr index 066e77b17fc7b..b7e753074d8f5 100644 --- a/tests/ui/nll/match-cfg-fake-edges.stderr +++ b/tests/ui/nll/match-cfg-fake-edges.stderr @@ -1,5 +1,5 @@ warning: irrefutable `if let` pattern - --> $DIR/match-cfg-fake-edges.rs:19:8 + --> $DIR/match-cfg-fake-edges.rs:17:8 | LL | if let _ = true { | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | if let _ = true { = note: `#[warn(irrefutable_let_patterns)]` on by default error[E0382]: use of moved value: `x` - --> $DIR/match-cfg-fake-edges.rs:16:10 + --> $DIR/match-cfg-fake-edges.rs:14:10 | LL | let x = String::new(); | - move occurs because `x` has type `String`, which does not implement the `Copy` trait @@ -26,7 +26,7 @@ LL | _ => drop(x.clone()), | ++++++++ error[E0382]: use of moved value: `x` - --> $DIR/match-cfg-fake-edges.rs:24:10 + --> $DIR/match-cfg-fake-edges.rs:22:10 | LL | let x = String::new(); | - move occurs because `x` has type `String`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ LL | drop(x.clone()) | ++++++++ error[E0382]: borrow of moved value: `x.0` - --> $DIR/match-cfg-fake-edges.rs:30:5 + --> $DIR/match-cfg-fake-edges.rs:28:5 | LL | (y, _) | (_, y) => (), | - value moved here @@ -58,7 +58,7 @@ LL | (ref y, _) | (_, y) => (), | +++ error[E0382]: borrow of moved value: `x.1` - --> $DIR/match-cfg-fake-edges.rs:32:5 + --> $DIR/match-cfg-fake-edges.rs:30:5 | LL | (y, _) | (_, y) => (), | - value moved here @@ -73,7 +73,7 @@ LL | (y, _) | (_, ref y) => (), | +++ error[E0382]: borrow of moved value: `x.0` - --> $DIR/match-cfg-fake-edges.rs:36:5 + --> $DIR/match-cfg-fake-edges.rs:34:5 | LL | let ((y, _) | (_, y)) = x; | - value moved here @@ -87,7 +87,7 @@ LL | let ((ref y, _) | (_, y)) = x; | +++ error[E0382]: borrow of moved value: `x.1` - --> $DIR/match-cfg-fake-edges.rs:38:5 + --> $DIR/match-cfg-fake-edges.rs:36:5 | LL | let ((y, _) | (_, y)) = x; | - value moved here @@ -102,7 +102,7 @@ LL | let ((y, _) | (_, ref y)) = x; | +++ error[E0381]: used binding `x` is possibly-uninitialized - --> $DIR/match-cfg-fake-edges.rs:72:19 + --> $DIR/match-cfg-fake-edges.rs:70:19 | LL | let x; | - binding declared here but left uninitialized @@ -113,7 +113,7 @@ LL | _ => drop(x), | if this pattern is matched, `x` is not initialized error[E0381]: used binding `x` isn't initialized - --> $DIR/match-cfg-fake-edges.rs:79:16 + --> $DIR/match-cfg-fake-edges.rs:77:16 | LL | let x; | - binding declared here but left uninitialized @@ -130,7 +130,7 @@ LL | let x = 42; | ++++ error[E0381]: used binding `x` isn't initialized - --> $DIR/match-cfg-fake-edges.rs:86:31 + --> $DIR/match-cfg-fake-edges.rs:84:31 | LL | let x; | - binding declared here but left uninitialized @@ -146,7 +146,7 @@ LL | let x = 42; | ++++ error[E0382]: use of moved value: `x` - --> $DIR/match-cfg-fake-edges.rs:99:22 + --> $DIR/match-cfg-fake-edges.rs:97:22 | LL | let x = String::new(); | - move occurs because `x` has type `String`, which does not implement the `Copy` trait @@ -163,7 +163,7 @@ LL | false if { drop(x.clone()); true } => {}, | ++++++++ error[E0382]: use of moved value: `x` - --> $DIR/match-cfg-fake-edges.rs:114:22 + --> $DIR/match-cfg-fake-edges.rs:112:22 | LL | let x = String::new(); | - move occurs because `x` has type `String`, which does not implement the `Copy` trait diff --git a/tests/ui/nll/match-guards-always-borrow.rs b/tests/ui/nll/match-guards-always-borrow.rs index 5271e3cfc6655..c8aa9686156c8 100644 --- a/tests/ui/nll/match-guards-always-borrow.rs +++ b/tests/ui/nll/match-guards-always-borrow.rs @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![allow(unused_mut)] // Here is arielb1's basic example from rust-lang/rust#27282 diff --git a/tests/ui/nll/match-guards-always-borrow.stderr b/tests/ui/nll/match-guards-always-borrow.stderr index 71977bd84721b..e48e5224c6fbb 100644 --- a/tests/ui/nll/match-guards-always-borrow.stderr +++ b/tests/ui/nll/match-guards-always-borrow.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/match-guards-always-borrow.rs:11:14 + --> $DIR/match-guards-always-borrow.rs:10:14 | LL | (|| { let mut bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait @@ -9,7 +9,7 @@ LL | (|| { let mut bar = foo; bar.take() })(); = note: variables bound in patterns cannot be moved from until after the end of the pattern guard error[E0507]: cannot move out of `foo` in pattern guard - --> $DIR/match-guards-always-borrow.rs:20:14 + --> $DIR/match-guards-always-borrow.rs:19:14 | LL | (|| { let mut bar = foo; bar.take() })(); | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait diff --git a/tests/ui/nll/match-guards-partially-borrow.rs b/tests/ui/nll/match-guards-partially-borrow.rs index 3a9e1654b1c2d..8eb4d21dbc268 100644 --- a/tests/ui/nll/match-guards-partially-borrow.rs +++ b/tests/ui/nll/match-guards-partially-borrow.rs @@ -5,8 +5,6 @@ // Test that we don't allow mutating the value being matched on in a way that // changes which patterns it matches, until we have chosen an arm. -#![feature(if_let_guard)] - fn ok_mutation_in_if_guard(mut q: i32) { match q { // OK, mutation doesn't change which patterns g matches diff --git a/tests/ui/nll/match-guards-partially-borrow.stderr b/tests/ui/nll/match-guards-partially-borrow.stderr index 7bdcbcb9c6ef6..88ad33b5ae23c 100644 --- a/tests/ui/nll/match-guards-partially-borrow.stderr +++ b/tests/ui/nll/match-guards-partially-borrow.stderr @@ -1,5 +1,5 @@ error[E0510]: cannot assign `q` in match guard - --> $DIR/match-guards-partially-borrow.rs:100:13 + --> $DIR/match-guards-partially-borrow.rs:98:13 | LL | match q { | - value is immutable in match guard @@ -8,7 +8,7 @@ LL | q = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `q` in match guard - --> $DIR/match-guards-partially-borrow.rs:111:13 + --> $DIR/match-guards-partially-borrow.rs:109:13 | LL | match q { | - value is immutable in match guard @@ -17,7 +17,7 @@ LL | q = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `r` in match guard - --> $DIR/match-guards-partially-borrow.rs:123:13 + --> $DIR/match-guards-partially-borrow.rs:121:13 | LL | match r { | - value is immutable in match guard @@ -26,7 +26,7 @@ LL | r = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `r` in match guard - --> $DIR/match-guards-partially-borrow.rs:135:13 + --> $DIR/match-guards-partially-borrow.rs:133:13 | LL | match r { | - value is immutable in match guard @@ -35,7 +35,7 @@ LL | r = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `t` in match guard - --> $DIR/match-guards-partially-borrow.rs:172:13 + --> $DIR/match-guards-partially-borrow.rs:170:13 | LL | match t { | - value is immutable in match guard @@ -44,7 +44,7 @@ LL | t = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `t` in match guard - --> $DIR/match-guards-partially-borrow.rs:183:13 + --> $DIR/match-guards-partially-borrow.rs:181:13 | LL | match t { | - value is immutable in match guard @@ -53,7 +53,7 @@ LL | t = true; | ^^^^^^^^ cannot assign error[E0510]: cannot mutably borrow `x.0` in match guard - --> $DIR/match-guards-partially-borrow.rs:197:22 + --> $DIR/match-guards-partially-borrow.rs:195:22 | LL | match x { | - value is immutable in match guard @@ -62,7 +62,7 @@ LL | Some(ref mut r) => *r = None, | ^^^^^^^^^ cannot mutably borrow error[E0510]: cannot mutably borrow `x.0` in match guard - --> $DIR/match-guards-partially-borrow.rs:213:22 + --> $DIR/match-guards-partially-borrow.rs:211:22 | LL | match x { | - value is immutable in match guard @@ -71,7 +71,7 @@ LL | Some(ref mut r) => *r = None, | ^^^^^^^^^ cannot mutably borrow error[E0506]: cannot assign to `t` because it is borrowed - --> $DIR/match-guards-partially-borrow.rs:225:13 + --> $DIR/match-guards-partially-borrow.rs:223:13 | LL | s if { | - `t` is borrowed here @@ -82,7 +82,7 @@ LL | } => (), // What value should `s` have in the arm? | - borrow later used here error[E0506]: cannot assign to `t` because it is borrowed - --> $DIR/match-guards-partially-borrow.rs:235:13 + --> $DIR/match-guards-partially-borrow.rs:233:13 | LL | s if let Some(()) = { | - `t` is borrowed here @@ -93,7 +93,7 @@ LL | } => (), // What value should `s` have in the arm? | - borrow later used here error[E0510]: cannot assign `y` in match guard - --> $DIR/match-guards-partially-borrow.rs:246:13 + --> $DIR/match-guards-partially-borrow.rs:244:13 | LL | match *y { | -- value is immutable in match guard @@ -102,7 +102,7 @@ LL | y = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `y` in match guard - --> $DIR/match-guards-partially-borrow.rs:257:13 + --> $DIR/match-guards-partially-borrow.rs:255:13 | LL | match *y { | -- value is immutable in match guard @@ -111,7 +111,7 @@ LL | y = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `z` in match guard - --> $DIR/match-guards-partially-borrow.rs:268:13 + --> $DIR/match-guards-partially-borrow.rs:266:13 | LL | match z { | - value is immutable in match guard @@ -120,7 +120,7 @@ LL | z = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `z` in match guard - --> $DIR/match-guards-partially-borrow.rs:279:13 + --> $DIR/match-guards-partially-borrow.rs:277:13 | LL | match z { | - value is immutable in match guard @@ -129,7 +129,7 @@ LL | z = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `a` in match guard - --> $DIR/match-guards-partially-borrow.rs:291:13 + --> $DIR/match-guards-partially-borrow.rs:289:13 | LL | match a { | - value is immutable in match guard @@ -138,7 +138,7 @@ LL | a = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `a` in match guard - --> $DIR/match-guards-partially-borrow.rs:303:13 + --> $DIR/match-guards-partially-borrow.rs:301:13 | LL | match a { | - value is immutable in match guard @@ -147,7 +147,7 @@ LL | a = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `b` in match guard - --> $DIR/match-guards-partially-borrow.rs:314:13 + --> $DIR/match-guards-partially-borrow.rs:312:13 | LL | match b { | - value is immutable in match guard @@ -156,7 +156,7 @@ LL | b = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `b` in match guard - --> $DIR/match-guards-partially-borrow.rs:325:13 + --> $DIR/match-guards-partially-borrow.rs:323:13 | LL | match b { | - value is immutable in match guard diff --git a/tests/ui/parser/struct-literal-in-match-guard.rs b/tests/ui/parser/struct-literal-in-match-guard.rs index ced01e08621a6..f7ee65b98e049 100644 --- a/tests/ui/parser/struct-literal-in-match-guard.rs +++ b/tests/ui/parser/struct-literal-in-match-guard.rs @@ -3,8 +3,6 @@ // Unlike `if` condition, `match` guards accept struct literals. // This is detected in . -#![feature(if_let_guard)] - #[derive(PartialEq)] struct Foo { x: isize, diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.stderr b/tests/ui/pattern/usefulness/conflicting_bindings.edition2021.stderr similarity index 75% rename from tests/ui/pattern/usefulness/conflicting_bindings.stderr rename to tests/ui/pattern/usefulness/conflicting_bindings.edition2021.stderr index 6f6504e6f6442..a71ea489ee140 100644 --- a/tests/ui/pattern/usefulness/conflicting_bindings.stderr +++ b/tests/ui/pattern/usefulness/conflicting_bindings.edition2021.stderr @@ -1,5 +1,5 @@ error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:5:9 + --> $DIR/conflicting_bindings.rs:9:9 | LL | let ref mut y @ ref mut z = x; | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -7,7 +7,7 @@ LL | let ref mut y @ ref mut z = x; | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:7:14 + --> $DIR/conflicting_bindings.rs:11:14 | LL | let Some(ref mut y @ ref mut z) = x else { return }; | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -15,7 +15,7 @@ LL | let Some(ref mut y @ ref mut z) = x else { return }; | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:9:17 + --> $DIR/conflicting_bindings.rs:13:17 | LL | if let Some(ref mut y @ ref mut z) = x {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -23,7 +23,7 @@ LL | if let Some(ref mut y @ ref mut z) = x {} | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:11:17 + --> $DIR/conflicting_bindings.rs:15:17 | LL | if let Some(ref mut y @ ref mut z) = x && true {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -31,7 +31,7 @@ LL | if let Some(ref mut y @ ref mut z) = x && true {} | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:13:43 + --> $DIR/conflicting_bindings.rs:17:43 | LL | if let Some(_) = Some(()) && let Some(ref mut y @ ref mut z) = x && true {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -39,7 +39,7 @@ LL | if let Some(_) = Some(()) && let Some(ref mut y @ ref mut z) = x && tru | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:15:20 + --> $DIR/conflicting_bindings.rs:19:20 | LL | while let Some(ref mut y @ ref mut z) = x {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -47,7 +47,7 @@ LL | while let Some(ref mut y @ ref mut z) = x {} | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:17:20 + --> $DIR/conflicting_bindings.rs:21:20 | LL | while let Some(ref mut y @ ref mut z) = x && true {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -55,7 +55,7 @@ LL | while let Some(ref mut y @ ref mut z) = x && true {} | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:20:9 + --> $DIR/conflicting_bindings.rs:24:9 | LL | ref mut y @ ref mut z => {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here @@ -63,12 +63,20 @@ LL | ref mut y @ ref mut z => {} | value is mutably borrowed by `y` here error: cannot borrow value as mutable more than once at a time - --> $DIR/conflicting_bindings.rs:23:24 + --> $DIR/conflicting_bindings.rs:27:24 | LL | () if let Some(ref mut y @ ref mut z) = x => {} | ^^^^^^^^^ --------- value is mutably borrowed by `z` here | | | value is mutably borrowed by `y` here -error: aborting due to 9 previous errors +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:31:51 + | +LL | () if let Some(()) = Some(()) && let Some(ref mut y @ ref mut z) = x && true => {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: aborting due to 10 previous errors diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.edition2024.stderr b/tests/ui/pattern/usefulness/conflicting_bindings.edition2024.stderr new file mode 100644 index 0000000000000..a71ea489ee140 --- /dev/null +++ b/tests/ui/pattern/usefulness/conflicting_bindings.edition2024.stderr @@ -0,0 +1,82 @@ +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:9:9 + | +LL | let ref mut y @ ref mut z = x; + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:11:14 + | +LL | let Some(ref mut y @ ref mut z) = x else { return }; + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:13:17 + | +LL | if let Some(ref mut y @ ref mut z) = x {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:15:17 + | +LL | if let Some(ref mut y @ ref mut z) = x && true {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:17:43 + | +LL | if let Some(_) = Some(()) && let Some(ref mut y @ ref mut z) = x && true {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:19:20 + | +LL | while let Some(ref mut y @ ref mut z) = x {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:21:20 + | +LL | while let Some(ref mut y @ ref mut z) = x && true {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:24:9 + | +LL | ref mut y @ ref mut z => {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:27:24 + | +LL | () if let Some(ref mut y @ ref mut z) = x => {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: cannot borrow value as mutable more than once at a time + --> $DIR/conflicting_bindings.rs:31:51 + | +LL | () if let Some(()) = Some(()) && let Some(ref mut y @ ref mut z) = x && true => {} + | ^^^^^^^^^ --------- value is mutably borrowed by `z` here + | | + | value is mutably borrowed by `y` here + +error: aborting due to 10 previous errors + diff --git a/tests/ui/pattern/usefulness/conflicting_bindings.rs b/tests/ui/pattern/usefulness/conflicting_bindings.rs index 16737e0a8946b..9c64390ef1293 100644 --- a/tests/ui/pattern/usefulness/conflicting_bindings.rs +++ b/tests/ui/pattern/usefulness/conflicting_bindings.rs @@ -1,4 +1,8 @@ -#![feature(if_let_guard, let_chains)] +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 + +#![cfg_attr(edition2021, feature(let_chains))] fn main() { let mut x = Some(String::new()); @@ -23,4 +27,9 @@ fn main() { () if let Some(ref mut y @ ref mut z) = x => {} //~ ERROR: mutable more than once _ => {} } + match () { + () if let Some(()) = Some(()) && let Some(ref mut y @ ref mut z) = x && true => {} + //~^ ERROR: mutable more than once + _ => {} + } } diff --git a/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.rs b/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.rs index c85af7f3bcc79..9eb5f6e5f2756 100644 --- a/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.rs +++ b/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - #![deny(irrefutable_let_patterns)] fn main() { diff --git a/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr b/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr index e8b7f40c70e48..5e79e9e76ea1e 100644 --- a/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr +++ b/tests/ui/pattern/usefulness/deny-irrefutable-let-patterns.stderr @@ -1,5 +1,5 @@ error: irrefutable `if let` pattern - --> $DIR/deny-irrefutable-let-patterns.rs:6:8 + --> $DIR/deny-irrefutable-let-patterns.rs:4:8 | LL | if let _ = 5 {} | ^^^^^^^^^ @@ -7,13 +7,13 @@ LL | if let _ = 5 {} = note: this pattern will always match, so the `if let` is useless = help: consider replacing the `if let` with a `let` note: the lint level is defined here - --> $DIR/deny-irrefutable-let-patterns.rs:3:9 + --> $DIR/deny-irrefutable-let-patterns.rs:1:9 | LL | #![deny(irrefutable_let_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: irrefutable `while let` pattern - --> $DIR/deny-irrefutable-let-patterns.rs:8:11 + --> $DIR/deny-irrefutable-let-patterns.rs:6:11 | LL | while let _ = 5 { | ^^^^^^^^^ @@ -22,7 +22,7 @@ LL | while let _ = 5 { = help: consider instead using a `loop { ... }` with a `let` inside it error: irrefutable `if let` guard pattern - --> $DIR/deny-irrefutable-let-patterns.rs:13:14 + --> $DIR/deny-irrefutable-let-patterns.rs:11:14 | LL | _ if let _ = 2 => {} | ^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs index 6f0d2b045918d..5eefbc65fc52e 100644 --- a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs +++ b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - enum VecWrapper { A(Vec) } fn if_guard(x: VecWrapper) -> usize { diff --git a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr index 0ab70c5ae8ab2..6de9627a14c18 100644 --- a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr +++ b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-across-arms.rs:7:36 + --> $DIR/rfc-reject-double-move-across-arms.rs:5:36 | LL | VecWrapper::A(v) if { drop(v); false } => 1, | ^ move occurs because `v` has type `Vec`, which does not implement the `Copy` trait @@ -11,7 +11,7 @@ LL | VecWrapper::A(v) if { drop(v.clone()); false } => 1, | ++++++++ error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-across-arms.rs:15:51 + --> $DIR/rfc-reject-double-move-across-arms.rs:13:51 | LL | VecWrapper::A(v) if let Some(()) = { drop(v); None } => 1, | ^ move occurs because `v` has type `Vec`, which does not implement the `Copy` trait diff --git a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs index 827335f6a8494..de3f23830d870 100644 --- a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs +++ b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - struct A { a: Box } fn if_guard(n: i32) { diff --git a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr index c261f9942838a..b78649f9174a1 100644 --- a/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr +++ b/tests/ui/rfcs/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-in-first-arm.rs:8:30 + --> $DIR/rfc-reject-double-move-in-first-arm.rs:6:30 | LL | A { a: v } if { drop(v); true } => v, | ^ move occurs because `v` has type `Box`, which does not implement the `Copy` trait @@ -11,7 +11,7 @@ LL | A { a: v } if { drop(v.clone()); true } => v, | ++++++++ error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-in-first-arm.rs:17:45 + --> $DIR/rfc-reject-double-move-in-first-arm.rs:15:45 | LL | A { a: v } if let Some(()) = { drop(v); Some(()) } => v, | ^ move occurs because `v` has type `Box`, which does not implement the `Copy` trait diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.rs index 1f32e4af121f2..1cef8b02e8d02 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - fn main() { match Some(None) { Some(x) if let Some(y) = x => (x, y), diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.stderr index 2463b7f3eacc7..acedbf966ae69 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/bindings.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `y` in this scope - --> $DIR/bindings.rs:6:14 + --> $DIR/bindings.rs:4:14 | LL | _ => y, | ^ not found in this scope error[E0425]: cannot find value `y` in this scope - --> $DIR/bindings.rs:8:5 + --> $DIR/bindings.rs:6:5 | LL | y | ^ not found in this scope diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/compare-drop-order.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/compare-drop-order.rs new file mode 100644 index 0000000000000..bffa0b1b75b4c --- /dev/null +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/compare-drop-order.rs @@ -0,0 +1,60 @@ +//@ run-pass +//@revisions: edition2015 edition2018 edition2021 edition2024 +//@[edition2015] edition:2015 +//@[edition2018] edition:2018 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 + +#![allow(irrefutable_let_patterns)] + +use std::sync::Mutex; + +static A: Mutex> = Mutex::new(Vec::new()); + +struct D(i32); + +fn make_d(x: i32) -> D { + A.lock().unwrap().push(x); + D(x) +} + +impl Drop for D { + fn drop(&mut self) { + A.lock().unwrap().push(!self.0); + } +} + +fn if_let_guard(num: i32) { + let _d = make_d(1); + match num { + 1 | 2 if let D(ref _x) = make_d(2) => { + make_d(3); + } + _ => {} + } +} + +fn if_let(num: i32) { + let _d = make_d(1); + match num { + 1 | 2 => { + if let D(ref _x) = make_d(2) { + make_d(3); + } + } + _ => {} + } +} + +fn main() { + if_let(1); + if_let(2); + if_let_guard(1); + if_let_guard(2); + let expected = + [1, 2, 3, !3, !2, !1, 1, 2, 3, !3, !2, !1, + // Here is two parts, first one is for basic if let inside the match arm + // And second part is for if let guard + 1, 2, 3, !3, !2, !1, 1, 2, 3, !3, !2, !1]; + assert_eq!(*A.lock().unwrap(), expected); +} diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs index e5078bacb932d..c4f0891ddce14 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/const-expr.rs @@ -1,7 +1,9 @@ // Ensure if let guards can be used in constant expressions. -//@ build-pass -#![feature(if_let_guard)] +//@ build-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 const fn match_if_let(x: Option, y: Option) -> i32 { match x { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/drop-order.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/drop-order.rs index 801329bcc5afd..139d04e0f4315 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/drop-order.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/drop-order.rs @@ -3,8 +3,10 @@ // For let guards temporaries live until the end of the arm. //@ run-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] use std::sync::Mutex; diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/drop-scope.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/drop-scope.rs index 0578b827a47a0..25e824d07cfea 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/drop-scope.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/drop-scope.rs @@ -2,8 +2,10 @@ // regression test for #118593 //@ check-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 -#![feature(if_let_guard)] #![feature(let_chains)] fn get_temp() -> Option { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs index b4eb541398cfa..843e35e8bc57f 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.rs @@ -1,4 +1,3 @@ -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] fn match_option(x: Option) { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr index ddd08854ff77f..ca92aa491d70f 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/exhaustive.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `None` not covered - --> $DIR/exhaustive.rs:5:11 + --> $DIR/exhaustive.rs:4:11 | LL | match x { | ^ pattern `None` not covered @@ -17,7 +17,7 @@ LL + None => todo!() | error[E0004]: non-exhaustive patterns: `()` not covered - --> $DIR/exhaustive.rs:14:11 + --> $DIR/exhaustive.rs:13:11 | LL | match x { | ^ pattern `()` not covered diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs deleted file mode 100644 index b1e305834cb2e..0000000000000 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs +++ /dev/null @@ -1,71 +0,0 @@ -// gate-test-if_let_guard - -use std::ops::Range; - -fn _if_let_guard() { - match () { - () if let 0 = 1 => {} - //~^ ERROR `if let` guards are experimental - - () if (let 0 = 1) => {} - //~^ ERROR expected expression, found `let` statement - - () if (((let 0 = 1))) => {} - //~^ ERROR expected expression, found `let` statement - - () if true && let 0 = 1 => {} - //~^ ERROR `if let` guards are experimental - - () if let 0 = 1 && true => {} - //~^ ERROR `if let` guards are experimental - - () if (let 0 = 1) && true => {} - //~^ ERROR expected expression, found `let` statement - - () if true && (let 0 = 1) => {} - //~^ ERROR expected expression, found `let` statement - - () if (let 0 = 1) && (let 0 = 1) => {} - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - - () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - //~^ ERROR `if let` guards are experimental - //~| ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - - - () if let Range { start: _, end: _ } = (true..true) && false => {} - //~^ ERROR `if let` guards are experimental - - _ => {} - } -} - -fn _macros() { - macro_rules! use_expr { - ($e:expr) => { - match () { - () if $e => {} - _ => {} - } - } - } - use_expr!((let 0 = 1 && 0 == 0)); - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - use_expr!((let 0 = 1)); - //~^ ERROR expected expression, found `let` statement - //~| ERROR expected expression, found `let` statement - match () { - #[cfg(false)] - () if let 0 = 1 => {} - //~^ ERROR `if let` guards are experimental - _ => {} - } - use_expr!(let 0 = 1); - //~^ ERROR no rules expected keyword `let` -} - -fn main() {} diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr deleted file mode 100644 index 19d1f4b0a573b..0000000000000 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.stderr +++ /dev/null @@ -1,235 +0,0 @@ -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:10:16 - | -LL | () if (let 0 = 1) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:10:16 - | -LL | () if (let 0 = 1) => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:13:18 - | -LL | () if (((let 0 = 1))) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:13:18 - | -LL | () if (((let 0 = 1))) => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:22:16 - | -LL | () if (let 0 = 1) && true => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:22:16 - | -LL | () if (let 0 = 1) && true => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:25:24 - | -LL | () if true && (let 0 = 1) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:25:24 - | -LL | () if true && (let 0 = 1) => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:28:16 - | -LL | () if (let 0 = 1) && (let 0 = 1) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:28:16 - | -LL | () if (let 0 = 1) && (let 0 = 1) => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:28:31 - | -LL | () if (let 0 = 1) && (let 0 = 1) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:28:31 - | -LL | () if (let 0 = 1) && (let 0 = 1) => {} - | ^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:32:42 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:32:42 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:32:55 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:32:42 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:32:68 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions -note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/feature-gate.rs:32:42 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:55:16 - | -LL | use_expr!((let 0 = 1 && 0 == 0)); - | ^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:55:16 - | -LL | use_expr!((let 0 = 1 && 0 == 0)); - | ^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:58:16 - | -LL | use_expr!((let 0 = 1)); - | ^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions - -error: expected expression, found `let` statement - --> $DIR/feature-gate.rs:58:16 - | -LL | use_expr!((let 0 = 1)); - | ^^^ - | - = note: only supported directly in conditions of `if` and `while` expressions - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: no rules expected keyword `let` - --> $DIR/feature-gate.rs:67:15 - | -LL | macro_rules! use_expr { - | --------------------- when calling this macro -... -LL | use_expr!(let 0 = 1); - | ^^^ no rules expected this token in macro call - | -note: while trying to match meta-variable `$e:expr` - --> $DIR/feature-gate.rs:48:10 - | -LL | ($e:expr) => { - | ^^^^^^^ - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:7:12 - | -LL | () if let 0 = 1 => {} - | ^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:16:12 - | -LL | () if true && let 0 = 1 => {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:19:12 - | -LL | () if let 0 = 1 && true => {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:32:12 - | -LL | () if let 0 = 1 && let 1 = 2 && (let 2 = 3 && let 3 = 4 && let 4 = 5) => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:39:12 - | -LL | () if let Range { start: _, end: _ } = (true..true) && false => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error[E0658]: `if let` guards are experimental - --> $DIR/feature-gate.rs:63:12 - | -LL | () if let 0 = 1 => {} - | ^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error: aborting due to 20 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs index 792225e656f42..649f459b00524 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.rs @@ -1,7 +1,5 @@ // References to by-move bindings in an if-let guard *cannot* be used after the guard. -#![feature(if_let_guard)] - fn main() { let x: Option> = Some(Some(String::new())); match x { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr index 741ae7c92d78b..ab363e9ec1f50 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-1.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x.0` because it is borrowed - --> $DIR/guard-lifetime-1.rs:8:14 + --> $DIR/guard-lifetime-1.rs:6:14 | LL | Some(mut y) if let Some(ref z) = y => { | ^^^^^ diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs index 09dc4bfde35f3..58738cc303292 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-lifetime-2.rs @@ -2,8 +2,6 @@ //@ check-pass -#![feature(if_let_guard)] - fn main() { let mut x: Option> = Some(Some(String::new())); match x { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs index 9353c9d92f89b..a9d6baf4f25ac 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.rs @@ -1,7 +1,5 @@ // Check mutable bindings cannot be mutated by an if-let guard. -#![feature(if_let_guard)] - fn main() { let x: Option> = Some(Some(6)); match x { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr index 98285f5c3e1c8..c9dec560eb3c7 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-1.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard - --> $DIR/guard-mutability-1.rs:8:33 + --> $DIR/guard-mutability-1.rs:6:33 | LL | Some(mut y) if let Some(ref mut z) = y => { | ^^^^^^^^^ cannot borrow as mutable diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs index 4efa02f57a6c7..c938bc9fa89cf 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.rs @@ -1,7 +1,5 @@ // Check mutable reference bindings cannot be mutated by an if-let guard. -#![feature(if_let_guard)] - fn main() { let mut x: Option> = Some(Some(6)); match x { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr index 31df8a922ace2..8836c1de5911b 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/guard-mutability-2.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `y.0` as mutable, as it is immutable for the pattern guard - --> $DIR/guard-mutability-2.rs:8:37 + --> $DIR/guard-mutability-2.rs:6:37 | LL | Some(ref mut y) if let Some(ref mut z) = *y => { | ^^^^^^^^^ cannot borrow as mutable diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/loop-mutability.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/loop-mutability.rs index c13804e4534ea..0925e8e295135 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/loop-mutability.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/loop-mutability.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(if_let_guard)] - fn split_last(_: &()) -> Option<(&i32, &i32)> { None } diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs index e1138835006b9..6b6e44e45f980 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.rs @@ -1,7 +1,5 @@ // Expression macros can't expand to a let match guard. -#![feature(if_let_guard)] - macro_rules! m { ($e:expr) => { let Some(x) = $e } //~^ ERROR expected expression, found `let` statement diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr index 921cd083fffd7..eda88c15f7beb 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/macro-expanded.stderr @@ -1,5 +1,5 @@ error: expected expression, found `let` statement - --> $DIR/macro-expanded.rs:6:20 + --> $DIR/macro-expanded.rs:4:20 | LL | ($e:expr) => { let Some(x) = $e } | ^^^ diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2021.stderr similarity index 92% rename from tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr rename to tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2021.stderr index 123c5f1943024..d526cc05dece7 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2021.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-if-let-chain.rs:12:23 + --> $DIR/move-guard-if-let-chain.rs:15:23 | LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ LL | (1, 2) if let ref y = x && c => (), | +++ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-if-let-chain.rs:36:23 + --> $DIR/move-guard-if-let-chain.rs:39:23 | LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait @@ -31,7 +31,7 @@ LL | (1, _) if let ref y = x && c => (), | +++ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-if-let-chain.rs:59:32 + --> $DIR/move-guard-if-let-chain.rs:62:32 | LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait @@ -45,7 +45,7 @@ LL | (1, _) | (_, 2) if let ref y = x && c => (), | +++ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-if-let-chain.rs:82:16 + --> $DIR/move-guard-if-let-chain.rs:85:16 | LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait @@ -61,7 +61,7 @@ LL | (1, 2) if let ref y = x && c => false, | +++ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-if-let-chain.rs:103:41 + --> $DIR/move-guard-if-let-chain.rs:106:41 | LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2024.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2024.stderr new file mode 100644 index 0000000000000..d526cc05dece7 --- /dev/null +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.edition2024.stderr @@ -0,0 +1,81 @@ +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-if-let-chain.rs:15:23 + | +LL | let x: Box<_> = Box::new(1); + | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait +... +LL | (1, 2) if let y = x && c => (), + | - value moved here +LL | (1, 2) if let z = x => (), + | ^ value used here after move + | +help: borrow this binding in the pattern to avoid moving the value + | +LL | (1, 2) if let ref y = x && c => (), + | +++ + +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-if-let-chain.rs:39:23 + | +LL | let x: Box<_> = Box::new(1); + | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait +... +LL | (1, _) if let y = x && c => (), + | - value moved here +LL | (_, 2) if let z = x => (), + | ^ value used here after move + | +help: borrow this binding in the pattern to avoid moving the value + | +LL | (1, _) if let ref y = x && c => (), + | +++ + +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-if-let-chain.rs:62:32 + | +LL | let x: Box<_> = Box::new(1); + | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait +... +LL | (1, _) | (_, 2) if let y = x && c => (), + | ^ value used here after move + | +help: borrow this binding in the pattern to avoid moving the value + | +LL | (1, _) | (_, 2) if let ref y = x && c => (), + | +++ + +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-if-let-chain.rs:85:16 + | +LL | let x: Box<_> = Box::new(1); + | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait +... +LL | (1, 2) if let y = x && c => false, + | - value moved here +LL | _ => { *x == 1 }, + | ^^ value used here after move + | +help: borrow this binding in the pattern to avoid moving the value + | +LL | (1, 2) if let ref y = x && c => false, + | +++ + +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-if-let-chain.rs:106:41 + | +LL | let x: Box<_> = Box::new(1); + | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait +... +LL | (1, 2) if let y = x && c && let z = x => false, + | - ^ value used here after move + | | + | value moved here + | +help: borrow this binding in the pattern to avoid moving the value + | +LL | (1, 2) if let ref y = x && c && let z = x => false, + | +++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs index 29f529a30c2ff..0ae45de11e71c 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let-chain.rs @@ -1,5 +1,8 @@ -//@ edition: 2024 -#![feature(if_let_guard)] +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 + +#![cfg_attr(edition2021, feature(let_chains))] #![allow(irrefutable_let_patterns)] fn same_pattern(c: bool) { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs index 73bee8a6c68e0..5f90df54abac0 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/move-guard-if-let.rs @@ -1,9 +1,8 @@ // Check that borrowck knows that moves in the pattern for if-let guards // only happen when the pattern is matched. -//@ build-pass +//@ check-pass -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] fn same_pattern() { @@ -36,6 +35,6 @@ fn main() { match v { (1, 2) if let y = x => false, - _ => { *x == 1 }, + _ => *x == 1, }; } diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs index a4cb73c650835..cec200f6ab214 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.rs @@ -1,8 +1,5 @@ -//@ edition: 2024 // Parenthesised let "expressions" are not allowed in guards -#![feature(if_let_guard)] - #[cfg(false)] fn un_cfged() { match () { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr index 0c16d9c5442b0..68a9faee0e2ce 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/parens.stderr @@ -1,51 +1,51 @@ error: expected expression, found `let` statement - --> $DIR/parens.rs:10:16 + --> $DIR/parens.rs:7:16 | LL | () if (let 0 = 1) => {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/parens.rs:10:16 + --> $DIR/parens.rs:7:16 | LL | () if (let 0 = 1) => {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/parens.rs:12:18 + --> $DIR/parens.rs:9:18 | LL | () if (((let 0 = 1))) => {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/parens.rs:12:18 + --> $DIR/parens.rs:9:18 | LL | () if (((let 0 = 1))) => {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/parens.rs:20:16 + --> $DIR/parens.rs:17:16 | LL | () if (let 0 = 1) => {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/parens.rs:20:16 + --> $DIR/parens.rs:17:16 | LL | () if (let 0 = 1) => {} | ^^^^^^^^^ error: expected expression, found `let` statement - --> $DIR/parens.rs:22:18 + --> $DIR/parens.rs:19:18 | LL | () if (((let 0 = 1))) => {} | ^^^^^^^^^ | = note: only supported directly in conditions of `if` and `while` expressions note: `let`s wrapped in parentheses are not supported in a context with let chains - --> $DIR/parens.rs:22:18 + --> $DIR/parens.rs:19:18 | LL | () if (((let 0 = 1))) => {} | ^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs index e836b0b88ffc7..c8afa1d561dd2 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/partially-macro-expanded.rs @@ -1,9 +1,6 @@ // Macros can be used for (parts of) the pattern and expression in an if let guard //@ check-pass -#![feature(if_let_guard)] -#![feature(let_chains)] - macro_rules! m { (pattern $i:ident) => { Some($i) }; (expression $e:expr) => { $e }; diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/run-pass.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/run-pass.rs index e8a74a4ac34bc..bea069b43915c 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/run-pass.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/run-pass.rs @@ -1,7 +1,5 @@ //@ run-pass -#![feature(if_let_guard)] - enum Foo { Bar, Baz, diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/scope.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/scope.rs index 56a6fb5bfa3ff..ef7c708670aba 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/scope.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/scope.rs @@ -1,9 +1,10 @@ // Tests for #88015 when using if let chains in match guards -//@run-pass +//@ run-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 -#![feature(if_let_guard)] -#![feature(let_chains)] #![allow(irrefutable_let_patterns)] fn lhs_let(opt: Option) { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency-async.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency-async.rs index 00eb952635a99..414387a911c98 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency-async.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency-async.rs @@ -1,11 +1,12 @@ // Check that temporaries in if-let guards are correctly scoped. // Regression test for #116079. -//@ build-pass -//@ edition:2018 -// -Zvalidate-mir - -#![feature(if_let_guard)] +//@ check-pass +//@revisions: edition2021 edition2024 edition2018 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 +//@[edition2018] edition:2018 +//@ compile-flags: -Zvalidate-mir static mut A: [i32; 5] = [1, 2, 3, 4, 5]; diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs index 1a36bc5b372f7..f0aff1e6311a9 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs @@ -1,9 +1,10 @@ // Check that temporaries in if-let guards are correctly scoped. -//@ build-pass -// -Zvalidate-mir - -#![feature(if_let_guard)] +//@ check-pass +//@revisions: edition2021 edition2024 +//@[edition2021] edition:2021 +//@[edition2024] edition:2024 +//@ compile-flags: -Zvalidate-mir fn fun() { match 0 { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs index e7946a2a23b11..a711820b4940a 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/shadowing.rs @@ -1,8 +1,6 @@ // Check shadowing in if let guards works as expected. -//@ check-pass -//@ edition: 2024 -#![feature(if_let_guard)] +//@ check-pass fn main() { let x: Option> = Some(Some(6)); diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs index 9bf6cfcccba0a..d8f9b36c8be55 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs @@ -4,7 +4,6 @@ //@ [edition2024] edition: 2024 //@ check-pass -#![feature(if_let_guard)] #![allow(irrefutable_let_patterns)] struct Pd; diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs index 9d20709ee9baa..ecefa31b9b83b 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/type-inference.rs @@ -1,7 +1,5 @@ //@ check-pass -#![feature(if_let_guard)] - struct S; fn get() -> Option { diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.rs index ad178dfa43947..3e5a6d273b2d5 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.rs @@ -1,5 +1,3 @@ -#![feature(if_let_guard)] - fn ok() -> Result, ()> { Ok(Some(true)) } diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.stderr index 4ce97a68a911a..dbd905bd5739a 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/typeck.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/typeck.rs:9:22 + --> $DIR/typeck.rs:7:22 | LL | Ok(x) if let Err(_) = x => {}, | ^^^^^^ - this expression has type `Option` @@ -10,7 +10,7 @@ LL | Ok(x) if let Err(_) = x => {}, found enum `Result<_, _>` error[E0308]: mismatched types - --> $DIR/typeck.rs:11:22 + --> $DIR/typeck.rs:9:22 | LL | Ok(x) if let 0 = x => {}, | ^ - this expression has type `Option` diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs index 3ad1a50c61f83..1b953937d266e 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.rs @@ -1,6 +1,5 @@ -#![feature(if_let_guard)] - #[deny(irrefutable_let_patterns)] + fn irrefutable_let_guard() { match Some(()) { Some(x) if let () = x => {} diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr index 693a06a229786..3c92c509a4719 100644 --- a/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/warns.stderr @@ -1,5 +1,5 @@ error: irrefutable `if let` guard pattern - --> $DIR/warns.rs:6:20 + --> $DIR/warns.rs:5:20 | LL | Some(x) if let () = x => {} | ^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | Some(x) if let () = x => {} = note: this pattern will always match, so the guard is useless = help: consider removing the guard and adding a `let` inside the match arm note: the lint level is defined here - --> $DIR/warns.rs:3:8 + --> $DIR/warns.rs:1:8 | LL | #[deny(irrefutable_let_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/warns.rs:15:25 + --> $DIR/warns.rs:14:25 | LL | x if let None | None = x => {} | ---- ^^^^ no value can reach this @@ -21,7 +21,7 @@ LL | x if let None | None = x => {} | matches all the relevant values | note: the lint level is defined here - --> $DIR/warns.rs:12:8 + --> $DIR/warns.rs:11:8 | LL | #[deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/if_let_guard_indirect_let_chains.rs similarity index 60% rename from tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.rs rename to tests/ui/rfcs/rfc-2497-if-let-chains/if_let_guard_indirect_let_chains.rs index f6de37867d855..9c9d1b9f1350a 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/if_let_guard_indirect_let_chains.rs @@ -1,7 +1,9 @@ +// https://github.com/rust-lang/rust/issues/93150 +//@ run-pass + fn main() { match true { _ if let true = true && true => {} - //~^ ERROR `if let` guards are _ => {} } } diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs index e7d69f89773ee..252a543c1f4c7 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/irrefutable-lets.rs @@ -1,7 +1,7 @@ //@ revisions: allowed disallowed //@[allowed] check-pass -#![feature(if_let_guard, let_chains)] +#![feature(let_chains)] #![cfg_attr(allowed, allow(irrefutable_let_patterns))] #![cfg_attr(disallowed, deny(irrefutable_let_patterns))] diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.stderr b/tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.stderr deleted file mode 100644 index 17fa37d2df322..0000000000000 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/issue-93150.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: `if let` guards are experimental - --> $DIR/issue-93150.rs:3:11 - | -LL | _ if let true = true && true => {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #51114 for more information - = help: add `#![feature(if_let_guard)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = help: you can write `if matches!(, )` instead of `if let = ` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/then-else-blocks.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/then-else-blocks.rs index 6d307be90c121..e5f3785506fc8 100644 --- a/tests/ui/rfcs/rfc-2497-if-let-chains/then-else-blocks.rs +++ b/tests/ui/rfcs/rfc-2497-if-let-chains/then-else-blocks.rs @@ -1,6 +1,6 @@ //@ run-pass -#![feature(if_let_guard, let_chains)] +#![feature(let_chains)] fn check_if_let(opt: Option>>, value: i32) -> bool { if let Some(first) = opt diff --git a/tests/ui/unpretty/interpolation-expanded.rs b/tests/ui/unpretty/interpolation-expanded.rs index 95280f97dac14..29ff4613aeacf 100644 --- a/tests/ui/unpretty/interpolation-expanded.rs +++ b/tests/ui/unpretty/interpolation-expanded.rs @@ -8,8 +8,6 @@ // Rust syntax. We also test negative cases: the pretty-printer should not be // synthesizing parentheses indiscriminately; only where necessary. -#![feature(if_let_guard)] - macro_rules! expr { ($expr:expr) => { $expr }; } diff --git a/tests/ui/unpretty/interpolation-expanded.stdout b/tests/ui/unpretty/interpolation-expanded.stdout index d46b46b67f41f..3acf94a23d439 100644 --- a/tests/ui/unpretty/interpolation-expanded.stdout +++ b/tests/ui/unpretty/interpolation-expanded.stdout @@ -1,4 +1,8 @@ #![feature(prelude_import)] +#[prelude_import] +use std::prelude::rust_2024::*; +#[macro_use] +extern crate std; //@ compile-flags: -Zunpretty=expanded //@ edition:2024 //@ check-pass @@ -9,12 +13,6 @@ // Rust syntax. We also test negative cases: the pretty-printer should not be // synthesizing parentheses indiscriminately; only where necessary. -#![feature(if_let_guard)] -#[prelude_import] -use std::prelude::rust_2024::*; -#[macro_use] -extern crate std; - macro_rules! expr { ($expr:expr) => { $expr }; } macro_rules! stmt { ($stmt:stmt) => { $stmt }; } diff --git a/tests/ui/unreachable-code.rs b/tests/ui/unreachable-code.rs index 0c46a38d73f35..5894c0f3188b0 100644 --- a/tests/ui/unreachable-code.rs +++ b/tests/ui/unreachable-code.rs @@ -5,7 +5,6 @@ #![allow(path_statements)] #![allow(unreachable_code)] #![allow(unused_variables)] -#![feature(if_let_guard)] fn id(x: bool) -> bool { x