mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Stabilize min_match_ergonomics_2024
This commit is contained in:
parent
575033c50c
commit
4aaada42d0
@ -516,9 +516,6 @@ declare_features! (
|
|||||||
(unstable, macro_metavar_expr_concat, "1.81.0", Some(124225)),
|
(unstable, macro_metavar_expr_concat, "1.81.0", Some(124225)),
|
||||||
/// Allows `#[marker]` on certain traits allowing overlapping implementations.
|
/// Allows `#[marker]` on certain traits allowing overlapping implementations.
|
||||||
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
|
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
|
||||||
/// A very restricted form of match ergonomics used over the 2024 edition transition to give
|
|
||||||
/// more time for T-lang to decide the final form of RFC3627.
|
|
||||||
(incomplete, min_match_ergonomics_2024, "CURRENT_RUSTC_VERSION", Some(123076)),
|
|
||||||
/// A minimal, sound subset of specialization intended to be used by the
|
/// A minimal, sound subset of specialization intended to be used by the
|
||||||
/// standard library until the soundness issues with specialization
|
/// standard library until the soundness issues with specialization
|
||||||
/// are fixed.
|
/// are fixed.
|
||||||
|
@ -1650,7 +1650,6 @@ declare_lint! {
|
|||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust,edition2021
|
/// ```rust,edition2021
|
||||||
/// #![feature(min_match_ergonomics_2024)]
|
|
||||||
/// #![warn(rust_2024_incompatible_pat)]
|
/// #![warn(rust_2024_incompatible_pat)]
|
||||||
///
|
///
|
||||||
/// if let Some(&a) = &Some(&0u8) {
|
/// if let Some(&a) = &Some(&0u8) {
|
||||||
@ -1671,12 +1670,10 @@ declare_lint! {
|
|||||||
pub RUST_2024_INCOMPATIBLE_PAT,
|
pub RUST_2024_INCOMPATIBLE_PAT,
|
||||||
Allow,
|
Allow,
|
||||||
"detects patterns whose meaning will change in Rust 2024",
|
"detects patterns whose meaning will change in Rust 2024",
|
||||||
@feature_gate = min_match_ergonomics_2024;
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
// FIXME uncomment below upon stabilization
|
|
||||||
/*@future_incompatible = FutureIncompatibleInfo {
|
|
||||||
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
|
||||||
reference: "123076",
|
reference: "123076",
|
||||||
};*/
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
|
@ -57,7 +57,7 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
|
|||||||
let result = pcx.lower_pattern(pat);
|
let result = pcx.lower_pattern(pat);
|
||||||
debug!("pat_from_hir({:?}) = {:?}", pat, result);
|
debug!("pat_from_hir({:?}) = {:?}", pat, result);
|
||||||
if let Some(sugg) = pcx.rust_2024_migration_suggestion {
|
if let Some(sugg) = pcx.rust_2024_migration_suggestion {
|
||||||
if tcx.features().min_match_ergonomics_2024 && sugg.is_hard_error {
|
if sugg.is_hard_error {
|
||||||
let mut err = tcx.dcx().struct_span_err(
|
let mut err = tcx.dcx().struct_span_err(
|
||||||
pat.span,
|
pat.span,
|
||||||
"patterns are not allowed to reset the default binding mode in rust 2024",
|
"patterns are not allowed to reset the default binding mode in rust 2024",
|
||||||
|
@ -1218,7 +1218,6 @@ symbols! {
|
|||||||
min_const_generics,
|
min_const_generics,
|
||||||
min_const_unsafe_fn,
|
min_const_unsafe_fn,
|
||||||
min_exhaustive_patterns,
|
min_exhaustive_patterns,
|
||||||
min_match_ergonomics_2024,
|
|
||||||
min_specialization,
|
min_specialization,
|
||||||
min_type_alias_impl_trait,
|
min_type_alias_impl_trait,
|
||||||
minnumf128,
|
minnumf128,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//@ run-rustfix
|
//@ run-rustfix
|
||||||
//@ rustfix-only-machine-applicable
|
//@ rustfix-only-machine-applicable
|
||||||
//@ aux-build:migration_lint_macros.rs
|
//@ aux-build:migration_lint_macros.rs
|
||||||
#![feature(mut_ref, min_match_ergonomics_2024)]
|
#![feature(mut_ref)]
|
||||||
#![allow(incomplete_features, unused)]
|
#![allow(incomplete_features, unused)]
|
||||||
#![deny(rust_2024_incompatible_pat)]
|
#![deny(rust_2024_incompatible_pat)]
|
||||||
|
|
||||||
@ -24,18 +24,22 @@ fn main() {
|
|||||||
|
|
||||||
let &Foo(mut x) = &Foo(0);
|
let &Foo(mut x) = &Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let &mut Foo(mut x) = &mut Foo(0);
|
let &mut Foo(mut x) = &mut Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let &Foo(ref x) = &Foo(0);
|
let &Foo(ref x) = &Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &0u8);
|
assert_type_eq(x, &0u8);
|
||||||
|
|
||||||
let &mut Foo(ref x) = &mut Foo(0);
|
let &mut Foo(ref x) = &mut Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &0u8);
|
assert_type_eq(x, &0u8);
|
||||||
|
|
||||||
let &Foo(x) = &Foo(0);
|
let &Foo(x) = &Foo(0);
|
||||||
@ -52,18 +56,22 @@ fn main() {
|
|||||||
|
|
||||||
let &Foo(&x) = &Foo(&0);
|
let &Foo(&x) = &Foo(&0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let &Foo(&mut x) = &Foo(&mut 0);
|
let &Foo(&mut x) = &Foo(&mut 0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let &mut Foo(&x) = &mut Foo(&0);
|
let &mut Foo(&x) = &mut Foo(&0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let &mut Foo(&mut x) = &mut Foo(&mut 0);
|
let &mut Foo(&mut x) = &mut Foo(&mut 0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
if let Some(x) = &&&&&Some(&0u8) {
|
if let Some(x) = &&&&&Some(&0u8) {
|
||||||
@ -72,21 +80,25 @@ fn main() {
|
|||||||
|
|
||||||
if let &&&&&Some(&x) = &&&&&Some(&0u8) {
|
if let &&&&&Some(&x) = &&&&&Some(&0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) {
|
if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) {
|
if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &mut 0u8);
|
assert_type_eq(x, &mut 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,17 +110,20 @@ fn main() {
|
|||||||
|
|
||||||
let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
|
let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(a, &0u32);
|
assert_type_eq(a, &0u32);
|
||||||
assert_type_eq(b, 0u32);
|
assert_type_eq(b, 0u32);
|
||||||
|
|
||||||
let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(a, 0u32);
|
assert_type_eq(a, 0u32);
|
||||||
assert_type_eq(b, &&0u32);
|
assert_type_eq(b, &&0u32);
|
||||||
assert_type_eq(c, &&0u32);
|
assert_type_eq(c, &&0u32);
|
||||||
|
|
||||||
if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
|
if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
|
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
|
||||||
{
|
{
|
||||||
assert_type_eq(a, &0u32);
|
assert_type_eq(a, &0u32);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//@ run-rustfix
|
//@ run-rustfix
|
||||||
//@ rustfix-only-machine-applicable
|
//@ rustfix-only-machine-applicable
|
||||||
//@ aux-build:migration_lint_macros.rs
|
//@ aux-build:migration_lint_macros.rs
|
||||||
#![feature(mut_ref, min_match_ergonomics_2024)]
|
#![feature(mut_ref)]
|
||||||
#![allow(incomplete_features, unused)]
|
#![allow(incomplete_features, unused)]
|
||||||
#![deny(rust_2024_incompatible_pat)]
|
#![deny(rust_2024_incompatible_pat)]
|
||||||
|
|
||||||
@ -24,18 +24,22 @@ fn main() {
|
|||||||
|
|
||||||
let Foo(mut x) = &Foo(0);
|
let Foo(mut x) = &Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let Foo(mut x) = &mut Foo(0);
|
let Foo(mut x) = &mut Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let Foo(ref x) = &Foo(0);
|
let Foo(ref x) = &Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &0u8);
|
assert_type_eq(x, &0u8);
|
||||||
|
|
||||||
let Foo(ref x) = &mut Foo(0);
|
let Foo(ref x) = &mut Foo(0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &0u8);
|
assert_type_eq(x, &0u8);
|
||||||
|
|
||||||
let &Foo(x) = &Foo(0);
|
let &Foo(x) = &Foo(0);
|
||||||
@ -52,18 +56,22 @@ fn main() {
|
|||||||
|
|
||||||
let Foo(&x) = &Foo(&0);
|
let Foo(&x) = &Foo(&0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let Foo(&mut x) = &Foo(&mut 0);
|
let Foo(&mut x) = &Foo(&mut 0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let Foo(&x) = &mut Foo(&0);
|
let Foo(&x) = &mut Foo(&0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
let Foo(&mut x) = &mut Foo(&mut 0);
|
let Foo(&mut x) = &mut Foo(&mut 0);
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
|
|
||||||
if let Some(x) = &&&&&Some(&0u8) {
|
if let Some(x) = &&&&&Some(&0u8) {
|
||||||
@ -72,21 +80,25 @@ fn main() {
|
|||||||
|
|
||||||
if let Some(&x) = &&&&&Some(&0u8) {
|
if let Some(&x) = &&&&&Some(&0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(&mut x) = &&&&&Some(&mut 0u8) {
|
if let Some(&mut x) = &&&&&Some(&mut 0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(&x) = &&&&&mut Some(&0u8) {
|
if let Some(&x) = &&&&&mut Some(&0u8) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, 0u8);
|
assert_type_eq(x, 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(x, &mut 0u8);
|
assert_type_eq(x, &mut 0u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,17 +110,20 @@ fn main() {
|
|||||||
|
|
||||||
let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
|
let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(a, &0u32);
|
assert_type_eq(a, &0u32);
|
||||||
assert_type_eq(b, 0u32);
|
assert_type_eq(b, 0u32);
|
||||||
|
|
||||||
let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
assert_type_eq(a, 0u32);
|
assert_type_eq(a, 0u32);
|
||||||
assert_type_eq(b, &&0u32);
|
assert_type_eq(b, &&0u32);
|
||||||
assert_type_eq(c, &&0u32);
|
assert_type_eq(c, &&0u32);
|
||||||
|
|
||||||
if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
|
if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
|
||||||
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
//~^ ERROR: the semantics of this pattern will change in edition 2024
|
||||||
|
//~| WARN: this changes meaning in Rust 2024
|
||||||
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
|
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
|
||||||
{
|
{
|
||||||
assert_type_eq(a, &0u32);
|
assert_type_eq(a, &0u32);
|
||||||
|
@ -6,6 +6,8 @@ LL | let Foo(mut x) = &Foo(0);
|
|||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/migration_lint.rs:7:9
|
--> $DIR/migration_lint.rs:7:9
|
||||||
|
|
|
|
||||||
@ -13,131 +15,169 @@ LL | #![deny(rust_2024_incompatible_pat)]
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:29:9
|
--> $DIR/migration_lint.rs:30:9
|
||||||
|
|
|
|
||||||
LL | let Foo(mut x) = &mut Foo(0);
|
LL | let Foo(mut x) = &mut Foo(0);
|
||||||
| -^^^^^^^^^
|
| -^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&mut`
|
| help: desugar the match ergonomics: `&mut`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:33:9
|
--> $DIR/migration_lint.rs:35:9
|
||||||
|
|
|
|
||||||
LL | let Foo(ref x) = &Foo(0);
|
LL | let Foo(ref x) = &Foo(0);
|
||||||
| -^^^^^^^^^
|
| -^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:37:9
|
--> $DIR/migration_lint.rs:40:9
|
||||||
|
|
|
|
||||||
LL | let Foo(ref x) = &mut Foo(0);
|
LL | let Foo(ref x) = &mut Foo(0);
|
||||||
| -^^^^^^^^^
|
| -^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&mut`
|
| help: desugar the match ergonomics: `&mut`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:53:9
|
--> $DIR/migration_lint.rs:57:9
|
||||||
|
|
|
|
||||||
LL | let Foo(&x) = &Foo(&0);
|
LL | let Foo(&x) = &Foo(&0);
|
||||||
| -^^^^^^
|
| -^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:57:9
|
--> $DIR/migration_lint.rs:62:9
|
||||||
|
|
|
|
||||||
LL | let Foo(&mut x) = &Foo(&mut 0);
|
LL | let Foo(&mut x) = &Foo(&mut 0);
|
||||||
| -^^^^^^^^^^
|
| -^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:61:9
|
--> $DIR/migration_lint.rs:67:9
|
||||||
|
|
|
|
||||||
LL | let Foo(&x) = &mut Foo(&0);
|
LL | let Foo(&x) = &mut Foo(&0);
|
||||||
| -^^^^^^
|
| -^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&mut`
|
| help: desugar the match ergonomics: `&mut`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:65:9
|
--> $DIR/migration_lint.rs:72:9
|
||||||
|
|
|
|
||||||
LL | let Foo(&mut x) = &mut Foo(&mut 0);
|
LL | let Foo(&mut x) = &mut Foo(&mut 0);
|
||||||
| -^^^^^^^^^^
|
| -^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&mut`
|
| help: desugar the match ergonomics: `&mut`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:73:12
|
--> $DIR/migration_lint.rs:81:12
|
||||||
|
|
|
|
||||||
LL | if let Some(&x) = &&&&&Some(&0u8) {
|
LL | if let Some(&x) = &&&&&Some(&0u8) {
|
||||||
| -^^^^^^^
|
| -^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&&&&&`
|
| help: desugar the match ergonomics: `&&&&&`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:78:12
|
--> $DIR/migration_lint.rs:87:12
|
||||||
|
|
|
|
||||||
LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) {
|
LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) {
|
||||||
| -^^^^^^^^^^^
|
| -^^^^^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&&&&&`
|
| help: desugar the match ergonomics: `&&&&&`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:83:12
|
--> $DIR/migration_lint.rs:93:12
|
||||||
|
|
|
|
||||||
LL | if let Some(&x) = &&&&&mut Some(&0u8) {
|
LL | if let Some(&x) = &&&&&mut Some(&0u8) {
|
||||||
| -^^^^^^^
|
| -^^^^^^^
|
||||||
| |
|
| |
|
||||||
| help: desugar the match ergonomics: `&&&&&mut`
|
| help: desugar the match ergonomics: `&&&&&mut`
|
||||||
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:88:12
|
--> $DIR/migration_lint.rs:99:12
|
||||||
|
|
|
|
||||||
LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
help: desugar the match ergonomics
|
help: desugar the match ergonomics
|
||||||
|
|
|
|
||||||
LL | if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
LL | if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
|
||||||
| ++++ ++++ +++++++
|
| ++++ ++++ +++++++
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:99:9
|
--> $DIR/migration_lint.rs:111:9
|
||||||
|
|
|
|
||||||
LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
|
LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
help: desugar the match ergonomics
|
help: desugar the match ergonomics
|
||||||
|
|
|
|
||||||
LL | let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
|
LL | let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
|
||||||
| + +++ +++
|
| + +++ +++
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:104:9
|
--> $DIR/migration_lint.rs:117:9
|
||||||
|
|
|
|
||||||
LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
help: desugar the match ergonomics
|
help: desugar the match ergonomics
|
||||||
|
|
|
|
||||||
LL | let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
LL | let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
|
||||||
| + +++
|
| + +++
|
||||||
|
|
||||||
error: the semantics of this pattern will change in edition 2024
|
error: the semantics of this pattern will change in edition 2024
|
||||||
--> $DIR/migration_lint.rs:110:12
|
--> $DIR/migration_lint.rs:124:12
|
||||||
|
|
|
|
||||||
LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
|
LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
= warning: this changes meaning in Rust 2024
|
||||||
|
= note: for more information, see 123076
|
||||||
help: desugar the match ergonomics
|
help: desugar the match ergonomics
|
||||||
|
|
|
|
||||||
LL | if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
|
LL | if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
|
||||||
| + + + +++
|
| + + + +++
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/migration_lint.rs:122:9
|
--> $DIR/migration_lint.rs:137:9
|
||||||
|
|
|
|
||||||
LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {
|
LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {
|
||||||
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
//@ check-fail
|
//@ check-fail
|
||||||
//@ edition: 2024
|
//@ edition: 2024
|
||||||
//@ compile-flags: -Zunstable-options
|
//@ compile-flags: -Zunstable-options
|
||||||
// gate-test-min_match_ergonomics_2024
|
|
||||||
#![feature(min_match_ergonomics_2024)]
|
|
||||||
#![allow(incomplete_features)]
|
|
||||||
#![deny(rust_2024_incompatible_pat)]
|
#![deny(rust_2024_incompatible_pat)]
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:27:20
|
--> $DIR/min_match_ergonomics_fail.rs:24:20
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&x,): &(T,)];
|
LL | test_pat_on_type![(&x,): &(T,)];
|
||||||
| ^^ ----- expected due to this
|
| ^^ ----- expected due to this
|
||||||
@ -15,7 +15,7 @@ LL + test_pat_on_type![(x,): &(T,)];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:29:20
|
--> $DIR/min_match_ergonomics_fail.rs:26:20
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&x,): &(&mut T,)];
|
LL | test_pat_on_type![(&x,): &(&mut T,)];
|
||||||
| ^^ ---------- expected due to this
|
| ^^ ---------- expected due to this
|
||||||
@ -31,7 +31,7 @@ LL + test_pat_on_type![(x,): &(&mut T,)];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:30:20
|
--> $DIR/min_match_ergonomics_fail.rs:27:20
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&mut x,): &(&T,)];
|
LL | test_pat_on_type![(&mut x,): &(&T,)];
|
||||||
| ^^^^^^ ------ expected due to this
|
| ^^^^^^ ------ expected due to this
|
||||||
@ -41,7 +41,7 @@ LL | test_pat_on_type![(&mut x,): &(&T,)];
|
|||||||
= note: expected reference `&T`
|
= note: expected reference `&T`
|
||||||
found mutable reference `&mut _`
|
found mutable reference `&mut _`
|
||||||
note: to declare a mutable binding use: `mut x`
|
note: to declare a mutable binding use: `mut x`
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:30:20
|
--> $DIR/min_match_ergonomics_fail.rs:27:20
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&mut x,): &(&T,)];
|
LL | test_pat_on_type![(&mut x,): &(&T,)];
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@ -52,7 +52,7 @@ LL + test_pat_on_type![(x,): &(&T,)];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:32:20
|
--> $DIR/min_match_ergonomics_fail.rs:29:20
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&x,): &&mut &(T,)];
|
LL | test_pat_on_type![(&x,): &&mut &(T,)];
|
||||||
| ^^ ----------- expected due to this
|
| ^^ ----------- expected due to this
|
||||||
@ -68,7 +68,7 @@ LL + test_pat_on_type![(x,): &&mut &(T,)];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:33:29
|
--> $DIR/min_match_ergonomics_fail.rs:30:29
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![Foo { f: (&x,) }: Foo];
|
LL | test_pat_on_type![Foo { f: (&x,) }: Foo];
|
||||||
| ^^ --- expected due to this
|
| ^^ --- expected due to this
|
||||||
@ -84,7 +84,7 @@ LL + test_pat_on_type![Foo { f: (x,) }: Foo];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:34:29
|
--> $DIR/min_match_ergonomics_fail.rs:31:29
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![Foo { f: (&x,) }: &mut Foo];
|
LL | test_pat_on_type![Foo { f: (&x,) }: &mut Foo];
|
||||||
| ^^ -------- expected due to this
|
| ^^ -------- expected due to this
|
||||||
@ -100,7 +100,7 @@ LL + test_pat_on_type![Foo { f: (x,) }: &mut Foo];
|
|||||||
|
|
|
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:28:19
|
--> $DIR/min_match_ergonomics_fail.rs:25:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&x,): &(&T,)];
|
LL | test_pat_on_type![(&x,): &(&T,)];
|
||||||
| -^^^^
|
| -^^^^
|
||||||
@ -108,7 +108,7 @@ LL | test_pat_on_type![(&x,): &(&T,)];
|
|||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:31:19
|
--> $DIR/min_match_ergonomics_fail.rs:28:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(&mut x,): &(&mut T,)];
|
LL | test_pat_on_type![(&mut x,): &(&mut T,)];
|
||||||
| -^^^^^^^^
|
| -^^^^^^^^
|
||||||
@ -116,7 +116,7 @@ LL | test_pat_on_type![(&mut x,): &(&mut T,)];
|
|||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:35:19
|
--> $DIR/min_match_ergonomics_fail.rs:32:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![Foo { f: &(x,) }: &Foo];
|
LL | test_pat_on_type![Foo { f: &(x,) }: &Foo];
|
||||||
| -^^^^^^^^^^^^^^^
|
| -^^^^^^^^^^^^^^^
|
||||||
@ -124,7 +124,7 @@ LL | test_pat_on_type![Foo { f: &(x,) }: &Foo];
|
|||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:36:19
|
--> $DIR/min_match_ergonomics_fail.rs:33:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(mut x,): &(T,)];
|
LL | test_pat_on_type![(mut x,): &(T,)];
|
||||||
| -^^^^^^^
|
| -^^^^^^^
|
||||||
@ -132,7 +132,7 @@ LL | test_pat_on_type![(mut x,): &(T,)];
|
|||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:37:19
|
--> $DIR/min_match_ergonomics_fail.rs:34:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(ref x,): &(T,)];
|
LL | test_pat_on_type![(ref x,): &(T,)];
|
||||||
| -^^^^^^^
|
| -^^^^^^^
|
||||||
@ -140,7 +140,7 @@ LL | test_pat_on_type![(ref x,): &(T,)];
|
|||||||
| help: desugar the match ergonomics: `&`
|
| help: desugar the match ergonomics: `&`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:38:19
|
--> $DIR/min_match_ergonomics_fail.rs:35:19
|
||||||
|
|
|
|
||||||
LL | test_pat_on_type![(ref mut x,): &mut (T,)];
|
LL | test_pat_on_type![(ref mut x,): &mut (T,)];
|
||||||
| -^^^^^^^^^^^
|
| -^^^^^^^^^^^
|
||||||
@ -148,7 +148,7 @@ LL | test_pat_on_type![(ref mut x,): &mut (T,)];
|
|||||||
| help: desugar the match ergonomics: `&mut`
|
| help: desugar the match ergonomics: `&mut`
|
||||||
|
|
||||||
error: patterns are not allowed to reset the default binding mode in rust 2024
|
error: patterns are not allowed to reset the default binding mode in rust 2024
|
||||||
--> $DIR/min_match_ergonomics_fail.rs:47:9
|
--> $DIR/min_match_ergonomics_fail.rs:44:9
|
||||||
|
|
|
|
||||||
LL | (&x,) => x,
|
LL | (&x,) => x,
|
||||||
| -^^^^
|
| -^^^^
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
//@ revisions: normal min_match_ergonomics
|
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
#![cfg_attr(min_match_ergonomics, feature(min_match_ergonomics_2024))]
|
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
Reference in New Issue
Block a user