1
Fork 0

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. /// Allows the `#[must_not_suspend]` attribute.
(unstable, must_not_suspend, "1.57.0", Some(83310)), (unstable, must_not_suspend, "1.57.0", Some(83310)),
/// Make `mut` not reset the binding mode on edition >= 2024. /// 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. /// Allows `mut ref` and `mut ref mut` identifier patterns.
(incomplete, mut_ref, "CURRENT_RUSTC_VERSION", Some(123076)), (incomplete, mut_ref, "CURRENT_RUSTC_VERSION", Some(123076)),
/// Allows using `#[naked]` on functions. /// Allows using `#[naked]` on functions.

View file

@ -636,7 +636,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let bm = match ba { let bm = match ba {
BindingAnnotation(ByRef::No, Mutability::Mut) BindingAnnotation(ByRef::No, Mutability::Mut)
if !(pat.span.at_least_rust_2024() 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(_)) => && matches!(def_br, ByRef::Yes(_)) =>
{ {
// `mut x` resets the binding mode in edition <= 2021. // `mut x` resets the binding mode in edition <= 2021.

View file

@ -1656,7 +1656,7 @@ declare_lint! {
pub DEREFERENCING_MUT_BINDING, pub DEREFERENCING_MUT_BINDING,
Allow, Allow,
"detects `mut x` bindings that change the type of `x`", "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 // FIXME uncomment below upon stabilization
/*@future_incompatible = FutureIncompatibleInfo { /*@future_incompatible = FutureIncompatibleInfo {
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024), reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),

View file

@ -1194,7 +1194,7 @@ symbols! {
multiple_supertrait_upcastable, multiple_supertrait_upcastable,
must_not_suspend, must_not_suspend,
must_use, must_use,
mut_dont_reset_binding_mode_2024, mut_preserve_binding_mode_2024,
mut_ref, mut_ref,
naked, naked,
naked_functions, naked_functions,

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types 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); LL | let Foo(mut a) = &Foo(0);
| ----- expected due to the type of this binding | ----- expected due to the type of this binding
@ -13,7 +13,7 @@ LL + a = 42;
| |
error[E0308]: mismatched types 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); LL | let Foo(mut a) = &mut Foo(0);
| ----- expected due to the type of this binding | ----- expected due to the type of this binding

View file

@ -1,6 +1,6 @@
//@ edition: 2021 //@ edition: 2021
//@ compile-flags: -Zunstable-options //@ compile-flags: -Zunstable-options
#![feature(mut_dont_reset_binding_mode_2024)] #![feature(mut_preserve_binding_mode_2024)]
struct Foo(u8); struct Foo(u8);

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types 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); LL | let Foo(mut a) = &Foo(0);
| ----- expected due to the type of this binding | ----- expected due to the type of this binding
@ -13,7 +13,7 @@ LL + a = 42;
| |
error[E0308]: mismatched types 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); LL | let Foo(mut a) = &mut Foo(0);
| ----- expected due to the type of this binding | ----- expected due to the type of this binding

View file

@ -1,7 +1,7 @@
//@ run-pass //@ run-pass
//@ edition: 2024 //@ edition: 2024
//@ compile-flags: -Zunstable-options //@ compile-flags: -Zunstable-options
#![feature(mut_dont_reset_binding_mode_2024)] #![feature(mut_preserve_binding_mode_2024)]
#![allow(unused)] #![allow(unused)]
struct Foo(u8); struct Foo(u8);

View file

@ -1,5 +1,5 @@
//@ edition: 2021 //@ edition: 2021
#![feature(mut_dont_reset_binding_mode_2024)] #![feature(mut_preserve_binding_mode_2024)]
#![allow(unused)] #![allow(unused)]
#![forbid(dereferencing_mut_binding)] #![forbid(dereferencing_mut_binding)]

View file

@ -1,28 +1,28 @@
error: dereferencing `mut` binding 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); LL | let Foo(mut a) = &Foo(0);
| ^^^^^ `mut` dereferences the type of this binding | ^^^^^ `mut` dereferences the type of this binding
| |
help: this will change in edition 2024 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); LL | let Foo(mut a) = &Foo(0);
| ^^^^^ | ^^^^^
note: the lint level is defined here 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)] LL | #![forbid(dereferencing_mut_binding)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
error: 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); LL | let Foo(mut a) = &mut Foo(0);
| ^^^^^ `mut` dereferences the type of this binding | ^^^^^ `mut` dereferences the type of this binding
| |
help: this will change in edition 2024 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); LL | let Foo(mut a) = &mut Foo(0);
| ^^^^^ | ^^^^^