diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 2a753af9387..3fc05752dd1 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -534,7 +534,7 @@ declare_features! ( /// Allows the `#[must_not_suspend]` attribute. (unstable, must_not_suspend, "1.57.0", Some(83310)), /// Make `mut` not reset the binding mode on edition >= 2024. - (unstable, mut_dont_reset_binding_mode_2024, "CURRENT_RUSTC_VERSION", Some(123076)), + (unstable, mut_preserve_binding_mode_2024, "CURRENT_RUSTC_VERSION", Some(123076)), /// Allows `mut ref` and `mut ref mut` identifier patterns. (incomplete, mut_ref, "CURRENT_RUSTC_VERSION", Some(123076)), /// Allows using `#[naked]` on functions. diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 252125aba7c..cdc6c4d809d 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -636,7 +636,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let bm = match ba { BindingAnnotation(ByRef::No, Mutability::Mut) if !(pat.span.at_least_rust_2024() - && self.tcx.features().mut_dont_reset_binding_mode_2024) + && self.tcx.features().mut_preserve_binding_mode_2024) && matches!(def_br, ByRef::Yes(_)) => { // `mut x` resets the binding mode in edition <= 2021. diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 3d80eb1cec9..e74cc388cab 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -1656,7 +1656,7 @@ declare_lint! { pub DEREFERENCING_MUT_BINDING, Allow, "detects `mut x` bindings that change the type of `x`", - @feature_gate = sym::mut_dont_reset_binding_mode_2024; + @feature_gate = sym::mut_preserve_binding_mode_2024; // FIXME uncomment below upon stabilization /*@future_incompatible = FutureIncompatibleInfo { reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 02550fd655c..0a95d86ccc8 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1194,7 +1194,7 @@ symbols! { multiple_supertrait_upcastable, must_not_suspend, must_use, - mut_dont_reset_binding_mode_2024, + mut_preserve_binding_mode_2024, mut_ref, naked, naked_functions, diff --git a/tests/ui/pattern/feature-gate-mut_dont_reset_binding_mode_2024.rs b/tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.rs similarity index 100% rename from tests/ui/pattern/feature-gate-mut_dont_reset_binding_mode_2024.rs rename to tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.rs diff --git a/tests/ui/pattern/feature-gate-mut_dont_reset_binding_mode_2024.stderr b/tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.stderr similarity index 84% rename from tests/ui/pattern/feature-gate-mut_dont_reset_binding_mode_2024.stderr rename to tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.stderr index 1624883de60..6d0a034be21 100644 --- a/tests/ui/pattern/feature-gate-mut_dont_reset_binding_mode_2024.stderr +++ b/tests/ui/pattern/feature-gate-mut_preserve_binding_mode_2024.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/feature-gate-mut_dont_reset_binding_mode_2024.rs:8:9 + --> $DIR/feature-gate-mut_preserve_binding_mode_2024.rs:8:9 | LL | let Foo(mut a) = &Foo(0); | ----- expected due to the type of this binding @@ -13,7 +13,7 @@ LL + a = 42; | error[E0308]: mismatched types - --> $DIR/feature-gate-mut_dont_reset_binding_mode_2024.rs:12:9 + --> $DIR/feature-gate-mut_preserve_binding_mode_2024.rs:12:9 | LL | let Foo(mut a) = &mut Foo(0); | ----- expected due to the type of this binding diff --git a/tests/ui/pattern/mut_dont_reset_binding_mode_2021.rs b/tests/ui/pattern/mut_preserve_binding_mode_2021.rs similarity index 84% rename from tests/ui/pattern/mut_dont_reset_binding_mode_2021.rs rename to tests/ui/pattern/mut_preserve_binding_mode_2021.rs index a9e12472734..658ba2851cc 100644 --- a/tests/ui/pattern/mut_dont_reset_binding_mode_2021.rs +++ b/tests/ui/pattern/mut_preserve_binding_mode_2021.rs @@ -1,6 +1,6 @@ //@ edition: 2021 //@ compile-flags: -Zunstable-options -#![feature(mut_dont_reset_binding_mode_2024)] +#![feature(mut_preserve_binding_mode_2024)] struct Foo(u8); diff --git a/tests/ui/pattern/mut_dont_reset_binding_mode_2021.stderr b/tests/ui/pattern/mut_preserve_binding_mode_2021.stderr similarity index 87% rename from tests/ui/pattern/mut_dont_reset_binding_mode_2021.stderr rename to tests/ui/pattern/mut_preserve_binding_mode_2021.stderr index 16818c900b3..9487aa64b4f 100644 --- a/tests/ui/pattern/mut_dont_reset_binding_mode_2021.stderr +++ b/tests/ui/pattern/mut_preserve_binding_mode_2021.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mut_dont_reset_binding_mode_2021.rs:9:9 + --> $DIR/mut_preserve_binding_mode_2021.rs:9:9 | LL | let Foo(mut a) = &Foo(0); | ----- expected due to the type of this binding @@ -13,7 +13,7 @@ LL + a = 42; | error[E0308]: mismatched types - --> $DIR/mut_dont_reset_binding_mode_2021.rs:13:9 + --> $DIR/mut_preserve_binding_mode_2021.rs:13:9 | LL | let Foo(mut a) = &mut Foo(0); | ----- expected due to the type of this binding diff --git a/tests/ui/pattern/mut_dont_reset_binding_mode_2024.rs b/tests/ui/pattern/mut_preserve_binding_mode_2024.rs similarity index 82% rename from tests/ui/pattern/mut_dont_reset_binding_mode_2024.rs rename to tests/ui/pattern/mut_preserve_binding_mode_2024.rs index 9ac5ec50c74..a5d7ac9d8e6 100644 --- a/tests/ui/pattern/mut_dont_reset_binding_mode_2024.rs +++ b/tests/ui/pattern/mut_preserve_binding_mode_2024.rs @@ -1,7 +1,7 @@ //@ run-pass //@ edition: 2024 //@ compile-flags: -Zunstable-options -#![feature(mut_dont_reset_binding_mode_2024)] +#![feature(mut_preserve_binding_mode_2024)] #![allow(unused)] struct Foo(u8); diff --git a/tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.rs b/tests/ui/pattern/mut_preserve_binding_mode_2024_lint.rs similarity index 86% rename from tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.rs rename to tests/ui/pattern/mut_preserve_binding_mode_2024_lint.rs index 2e8a82d12cd..d3e3ffffcc5 100644 --- a/tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.rs +++ b/tests/ui/pattern/mut_preserve_binding_mode_2024_lint.rs @@ -1,5 +1,5 @@ //@ edition: 2021 -#![feature(mut_dont_reset_binding_mode_2024)] +#![feature(mut_preserve_binding_mode_2024)] #![allow(unused)] #![forbid(dereferencing_mut_binding)] diff --git a/tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.stderr b/tests/ui/pattern/mut_preserve_binding_mode_2024_lint.stderr similarity index 70% rename from tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.stderr rename to tests/ui/pattern/mut_preserve_binding_mode_2024_lint.stderr index 4db775f0f51..e8d11acd83e 100644 --- a/tests/ui/pattern/mut_dont_reset_binding_mode_2024_lint.stderr +++ b/tests/ui/pattern/mut_preserve_binding_mode_2024_lint.stderr @@ -1,28 +1,28 @@ error: dereferencing `mut` binding - --> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:9:13 + --> $DIR/mut_preserve_binding_mode_2024_lint.rs:9:13 | LL | let Foo(mut a) = &Foo(0); | ^^^^^ `mut` dereferences the type of this binding | help: this will change in edition 2024 - --> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:9:13 + --> $DIR/mut_preserve_binding_mode_2024_lint.rs:9:13 | LL | let Foo(mut a) = &Foo(0); | ^^^^^ note: the lint level is defined here - --> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:4:11 + --> $DIR/mut_preserve_binding_mode_2024_lint.rs:4:11 | LL | #![forbid(dereferencing_mut_binding)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: dereferencing `mut` binding - --> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:13:13 + --> $DIR/mut_preserve_binding_mode_2024_lint.rs:13:13 | LL | let Foo(mut a) = &mut Foo(0); | ^^^^^ `mut` dereferences the type of this binding | help: this will change in edition 2024 - --> $DIR/mut_dont_reset_binding_mode_2024_lint.rs:13:13 + --> $DIR/mut_preserve_binding_mode_2024_lint.rs:13:13 | LL | let Foo(mut a) = &mut Foo(0); | ^^^^^