mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-06 20:13:42 +00:00
Rename feature gate
This commit is contained in:
parent
1b2e471b43
commit
e13911e6e8
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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),
|
||||
|
@ -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,
|
||||
|
@ -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
|
@ -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);
|
||||
|
@ -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
|
@ -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);
|
@ -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)]
|
||||
|
@ -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);
|
||||
| ^^^^^
|
Loading…
Reference in New Issue
Block a user