Rename feature gate

This commit is contained in:
Jules Bertholet 2024-04-14 11:12:52 -04:00
parent 1b2e471b43
commit e13911e6e8
No known key found for this signature in database
GPG Key ID: 32034DAFC38C1BFC
11 changed files with 16 additions and 16 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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),

View File

@ -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,

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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)]

View File

@ -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);
| ^^^^^