diff --git a/compiler/rustc_mir_build/src/thir/pattern/migration.rs b/compiler/rustc_mir_build/src/thir/pattern/migration.rs index 9a5cc08e6c4c..96021704d329 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/migration.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/migration.rs @@ -55,10 +55,15 @@ pub(super) fn emit<'tcx>(self, tcx: TyCtxt<'tcx>, pat_id: HirId) { self.format_subdiagnostics(&mut err); err.emit(); } else { - tcx.node_span_lint(lint::builtin::RUST_2024_INCOMPATIBLE_PAT, pat_id, spans, |diag| { - diag.primary_message(primary_message); - self.format_subdiagnostics(diag); - }); + tcx.emit_node_span_lint( + lint::builtin::RUST_2024_INCOMPATIBLE_PAT, + pat_id, + spans, + rustc_errors::DiagDecorator(|diag| { + diag.primary_message(primary_message); + self.format_subdiagnostics(diag); + }), + ); } } diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr index 01fcfdc8be6e..4963e80ec8cc 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.stderr @@ -4,13 +4,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let Foo(mut x) = &Foo(0); | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:25:9 | LL | let Foo(mut x) = &Foo(0); | ^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see note: the lint level is defined here --> $DIR/migration_lint.rs:7:9 | @@ -27,13 +27,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let Foo(mut x) = &mut Foo(0); | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:30:9 | LL | let Foo(mut x) = &mut Foo(0); | ^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &mut Foo(mut x) = &mut Foo(0); @@ -45,13 +45,13 @@ error: cannot explicitly borrow within an implicitly-borrowing pattern in Rust 2 LL | let Foo(ref x) = &Foo(0); | ^^^ explicit `ref` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:35:9 | LL | let Foo(ref x) = &Foo(0); | ^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: remove the unnecessary binding modifier | LL - let Foo(ref x) = &Foo(0); @@ -64,13 +64,13 @@ error: cannot explicitly borrow within an implicitly-borrowing pattern in Rust 2 LL | let Foo(ref x) = &mut Foo(0); | ^^^ explicit `ref` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:40:9 | LL | let Foo(ref x) = &mut Foo(0); | ^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &mut Foo(ref x) = &mut Foo(0); @@ -82,13 +82,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let Foo(&x) = &Foo(&0); | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:57:9 | LL | let Foo(&x) = &Foo(&0); | ^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &Foo(&x) = &Foo(&0); @@ -100,13 +100,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let Foo(&mut x) = &Foo(&mut 0); | ^^^^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:62:9 | LL | let Foo(&mut x) = &Foo(&mut 0); | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &Foo(&mut x) = &Foo(&mut 0); @@ -118,13 +118,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let Foo(&x) = &mut Foo(&0); | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:67:9 | LL | let Foo(&x) = &mut Foo(&0); | ^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &mut Foo(&x) = &mut Foo(&0); @@ -136,13 +136,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let Foo(&mut x) = &mut Foo(&mut 0); | ^^^^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:72:9 | LL | let Foo(&mut x) = &mut Foo(&mut 0); | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &mut Foo(&mut x) = &mut Foo(&mut 0); @@ -154,13 +154,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | if let Some(&x) = &&&&&Some(&0u8) { | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:81:12 | LL | if let Some(&x) = &&&&&Some(&0u8) { | ^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | if let &&&&&Some(&x) = &&&&&Some(&0u8) { @@ -172,13 +172,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { | ^^^^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:87:12 | LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { | ^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) { @@ -190,13 +190,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | if let Some(&x) = &&&&&mut Some(&0u8) { | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:93:12 | LL | if let Some(&x) = &&&&&mut Some(&0u8) { | ^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) { @@ -208,13 +208,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { | ^^^^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:99:12 | LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { | ^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using a variable binding mode | LL | if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) { @@ -226,13 +226,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:111:9 | LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern and borrow explicitly using variable binding modes | LL | let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 }; @@ -246,13 +246,13 @@ LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:117:9 | LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern and borrow explicitly using a variable binding mode | LL | let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 }; @@ -266,13 +266,13 @@ LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:124:12 | LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using a variable binding mode | LL | if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } = @@ -306,8 +306,6 @@ LL | let [&mut [ref a]] = &mut [&mut &[0]]; | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:145:15 | @@ -318,6 +316,8 @@ note: matching on a reference type with a non-reference pattern implicitly borro | LL | let [&mut [ref a]] = &mut [&mut &[0]]; | ^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | let &mut [&mut &[ref a]] = &mut [&mut &[0]]; @@ -329,13 +329,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let [&(_)] = &[&0]; | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:150:9 | LL | let [&(_)] = &[&0]; | ^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &[&(_)] = &[&0]; @@ -349,13 +349,13 @@ LL | let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; | | | explicit `ref` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:157:9 | LL | let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: remove the unnecessary binding modifiers | LL - let Struct { ref a, ref b, c } = &Struct { a: 0, b: 0, c: 0 }; @@ -370,13 +370,13 @@ LL | let Struct { ref a, ref mut b, c } = &mut Struct { a: 0, b: 0, c: 0 }; | | | explicit `ref` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:164:9 | LL | let Struct { ref a, ref mut b, c } = &mut Struct { a: 0, b: 0, c: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&mut _` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern and borrow explicitly using a variable binding mode | LL | let &mut Struct { ref a, ref mut b, ref mut c } = &mut Struct { a: 0, b: 0, c: 0 }; @@ -390,13 +390,13 @@ LL | let Struct { a: &[ref a], b: &mut [[b]], c } = &mut &Struct { a: &[0], | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:172:9 | LL | let Struct { a: &[ref a], b: &mut [[b]], c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using variable binding modes | LL | let &mut &Struct { a: &[ref a], b: &mut [&[ref b]], ref c } = &mut &Struct { a: &[0], b: &mut [&[0]], c: 0 }; @@ -408,13 +408,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let Foo(&ref a) = &Foo(&0); | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:180:9 | LL | let Foo(&ref a) = &Foo(&0); | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &Foo(&ref a) = &Foo(&0); @@ -426,13 +426,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let (&a, b, [c], [(d, [e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:186:9 | LL | let (&a, b, [c], [(d, [e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); | ^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using variable binding modes | LL | let &(&a, ref b, &[ref c], &mut [&mut (ref d, &[ref e])]) = &(&0, 0, &[0], &mut [&mut (0, &[0])]); @@ -444,13 +444,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let (a, [b], [mut c]) = &(0, &mut [0], &[0]); | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:196:9 | LL | let (a, [b], [mut c]) = &(0, &mut [0], &[0]); | ^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using variable binding modes | LL | let &(ref a, &mut [ref b], &[mut c]) = &(0, &mut [0], &[0]); @@ -464,13 +464,13 @@ LL | let (&a, (b, &[ref c])) = &(&0, &mut (0, &[0])); | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:204:9 | LL | let (&a, (b, &[ref c])) = &(&0, &mut (0, &[0])); | ^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns and borrow explicitly using a variable binding mode | LL | let &(&a, &mut (ref b, &[ref c])) = &(&0, &mut (0, &[0])); @@ -482,13 +482,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let [mut a @ b] = &[0]; | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:212:9 | LL | let [mut a @ b] = &[0]; | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern and borrow explicitly using a variable binding mode | LL | let &[mut a @ ref b] = &[0]; @@ -500,13 +500,13 @@ error: cannot mutably bind by value within an implicitly-borrowing pattern in Ru LL | let [a @ mut b] = &[0]; | ^^^ `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:219:9 | LL | let [a @ mut b] = &[0]; | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern and borrow explicitly using a variable binding mode | LL | let &[ref a @ mut b] = &[0]; @@ -520,8 +520,6 @@ LL | let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:226:31 | @@ -532,6 +530,8 @@ note: matching on a reference type with a non-reference pattern implicitly borro | LL | let [Foo(&ref a @ ref b), Foo(&ref c @ d)] = [&Foo(&0); 2]; | ^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | let [&Foo(&ref a @ ref b), &Foo(&ref c @ d)] = [&Foo(&0); 2]; @@ -545,8 +545,6 @@ LL | let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; | | | reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:235:33 | @@ -557,6 +555,8 @@ note: matching on a reference type with a non-reference pattern implicitly borro | LL | let [Foo(&ref a @ [ref b]), Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; | ^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on these references with reference patterns to avoid implicitly borrowing | LL | let [&Foo(&ref a @ [ref b]), &Foo(&ref c @ [d])] = [&Foo(&[0]); 2]; @@ -586,13 +586,13 @@ error: cannot explicitly dereference within an implicitly-borrowing pattern in R LL | let [&migration_lint_macros::bind_ref!(a)] = &[&0]; | ^ reference pattern not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:249:9 | LL | let [&migration_lint_macros::bind_ref!(a)] = &[&0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &[&migration_lint_macros::bind_ref!(a)] = &[&0]; @@ -606,13 +606,13 @@ LL | let (mut a, ref b) = &(0, 0); | | | `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:255:9 | LL | let (mut a, ref b) = &(0, 0); | ^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &(mut a, ref b) = &(0, 0); @@ -626,13 +626,13 @@ LL | let (mut a, &b) = &(0, &0); | | | `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:261:9 | LL | let (mut a, &b) = &(0, &0); | ^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &(mut a, &b) = &(0, &0); @@ -647,13 +647,13 @@ LL | let (mut a, ref b, &c) = &(0, 0, &0); | | explicit `ref` binding modifier not allowed when implicitly borrowing | `mut` binding modifier not allowed when implicitly borrowing | - = warning: this changes meaning in Rust 2024 - = note: for more information, see note: matching on a reference type with a non-reference pattern implicitly borrows the contents --> $DIR/migration_lint.rs:267:9 | LL | let (mut a, ref b, &c) = &(0, 0, &0); | ^^^^^^^^^^^^^^^^^^ this non-reference pattern matches on a reference type `&_` + = warning: this changes meaning in Rust 2024 + = note: for more information, see help: match on the reference with a reference pattern to avoid implicitly borrowing | LL | let &(mut a, ref b, &c) = &(0, 0, &0);