diff options
| author | dianne <diannes.gm@gmail.com> | 2025-02-03 22:18:00 -0800 |
|---|---|---|
| committer | dianne <diannes.gm@gmail.com> | 2025-02-03 22:23:35 -0800 |
| commit | 4331f55b729d1a41004305f85dfe4dbbcec3ee3f (patch) | |
| tree | b3ed9d2f2ac05e3c2b8b0a503f55dcfc39d96767 /tests/ui/pattern | |
| parent | 9202001c1c5c3bd9c1fce522744c8620e17d791a (diff) | |
| download | rust-4331f55b729d1a41004305f85dfe4dbbcec3ee3f.tar.gz rust-4331f55b729d1a41004305f85dfe4dbbcec3ee3f.zip | |
highlight the whole problem subpattern when pointing out the default binding mode
Diffstat (limited to 'tests/ui/pattern')
4 files changed, 161 insertions, 43 deletions
diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr index fbe1164c625..d4313f915df 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr @@ -14,7 +14,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 | LL | let [ref mut x] = &[0]; - | ^^^^^^^ default binding mode is `ref` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -32,7 +35,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:75:10 | LL | let [ref x] = &[0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -44,7 +50,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:79:10 | LL | let [ref x] = &mut [0]; - | ^^^ default binding mode is `ref mut` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -56,7 +65,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:83:10 | LL | let [ref mut x] = &mut [0]; - | ^^^^^^^ default binding mode is `ref mut` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr index f355b7c61a2..8edb6511f23 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.structural2024.stderr @@ -2,7 +2,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:15:11 | LL | let [&ref x] = &[&0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -14,7 +17,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:20:11 | LL | let [&ref x] = &mut [&0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -26,7 +32,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:25:15 | LL | let [&mut ref x] = &mut [&mut 0]; - | ^^^ default binding mode is `ref mut` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -38,7 +47,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:30:15 | LL | let [&mut ref mut x] = &mut [&mut 0]; - | ^^^^^^^ default binding mode is `ref mut` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -50,7 +62,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:39:11 | LL | let [&ref x] = &[&mut 0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -62,7 +77,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:45:11 | LL | let [&ref x] = &mut [&mut 0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -74,7 +92,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:54:15 | LL | let [&mut ref x] = &[&mut 0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -86,7 +107,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 | LL | let [ref mut x] = &[0]; - | ^^^^^^^ default binding mode is `ref` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -104,7 +128,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:75:10 | LL | let [ref x] = &[0]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -116,7 +143,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:79:10 | LL | let [ref x] = &mut [0]; - | ^^^ default binding mode is `ref mut` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -128,7 +158,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/ref-binding-on-inh-ref-errors.rs:83:10 | LL | let [ref mut x] = &mut [0]; - | ^^^^^^^ default binding mode is `ref mut` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit 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 0a9d2cf223a..cbb94a52878 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 @@ -2,7 +2,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:25:13 | LL | let Foo(mut x) = &Foo(0); - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -20,7 +23,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:30:13 | LL | let Foo(mut x) = &mut Foo(0); - | ^^^ default binding mode is `ref mut` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -33,7 +39,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:35:13 | LL | let Foo(ref x) = &Foo(0); - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -46,7 +55,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:40:13 | LL | let Foo(ref x) = &mut Foo(0); - | ^^^ default binding mode is `ref mut` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -59,7 +71,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:57:13 | LL | let Foo(&x) = &Foo(&0); - | ^ default binding mode is `ref` + | ^- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -72,7 +87,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:62:13 | LL | let Foo(&mut x) = &Foo(&mut 0); - | ^^^^ default binding mode is `ref` + | ^^^^-- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -85,7 +103,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:67:13 | LL | let Foo(&x) = &mut Foo(&0); - | ^ default binding mode is `ref mut` + | ^- + | | + | this reference pattern + | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -98,7 +119,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:72:13 | LL | let Foo(&mut x) = &mut Foo(&mut 0); - | ^^^^ default binding mode is `ref mut` + | ^^^^-- + | | + | this reference pattern + | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -111,7 +135,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:81:17 | LL | if let Some(&x) = &&&&&Some(&0u8) { - | ^ default binding mode is `ref` + | ^- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -124,7 +151,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:87:17 | LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) { - | ^^^^ default binding mode is `ref` + | ^^^^-- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -137,7 +167,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:93:17 | LL | if let Some(&x) = &&&&&mut Some(&0u8) { - | ^ default binding mode is `ref` + | ^- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -150,7 +183,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:99:17 | LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) { - | ^^^^ default binding mode is `ref mut` + | ^^^^-------------- + | | + | this reference pattern + | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -163,7 +199,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:111:21 | LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 }; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -176,8 +215,11 @@ error: binding modifiers and reference patterns may only be written when the def --> $DIR/migration_lint.rs:117:21 | LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 }; - | ^ ^^^ default binding mode is `ref` - | | + | ^- ^^^-- + | | | + | | this binding modifier + | | default binding mode is `ref` + | this reference pattern | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 @@ -191,8 +233,11 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:124:24 | LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } = - | ^ ^ default binding mode is `ref` - | | + | ^------- ^- + | | | + | | this reference pattern + | | default binding mode is `ref` + | this reference pattern | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 @@ -206,8 +251,9 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/migration_lint.rs:137:15 | LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => { - | ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within macro expansion + | ^^^-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ occurs within macro expansion | | + | this binding modifier | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> @@ -221,8 +267,11 @@ error: binding modifiers and reference patterns may only be written when the def --> $DIR/migration_lint.rs:145:10 | LL | let [&mut [ref a]] = &mut [&mut &[0]]; - | ^^^^ ^^^ default binding mode is `ref` - | | + | ^^^^--^^^--- + | | | + | | this binding modifier + | | default binding mode is `ref` + | this reference pattern | default binding mode is `ref mut` | = warning: this changes meaning in Rust 2024 @@ -236,7 +285,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/migration_lint.rs:150:10 | LL | let [&(_)] = &[&0]; - | ^^ default binding mode is `ref` + | ^^-- + | | + | this reference pattern + | default binding mode is `ref` | = warning: this changes meaning in Rust 2024 = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr index 89868a1f333..ce93199b186 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/min_match_ergonomics_fail.stderr @@ -103,7 +103,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/min_match_ergonomics_fail.rs:24:20 | LL | test_pat_on_type![(&x,): &(&T,)]; - | ^ default binding mode is `ref` + | ^- + | | + | this reference pattern + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -115,7 +118,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/min_match_ergonomics_fail.rs:27:20 | LL | test_pat_on_type![(&mut x,): &(&mut T,)]; - | ^^^^ default binding mode is `ref` + | ^^^^-- + | | + | this reference pattern + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -127,7 +133,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/min_match_ergonomics_fail.rs:31:28 | LL | test_pat_on_type![Foo { f: &(x,) }: &Foo]; - | ^ default binding mode is `ref` + | ^---- + | | + | this reference pattern + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -139,7 +148,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/min_match_ergonomics_fail.rs:32:20 | LL | test_pat_on_type![(mut x,): &(T,)]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -151,7 +163,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/min_match_ergonomics_fail.rs:33:20 | LL | test_pat_on_type![(ref x,): &(T,)]; - | ^^^ default binding mode is `ref` + | ^^^-- + | | + | this binding modifier + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -163,7 +178,10 @@ error: binding modifiers may only be written when the default binding mode is `m --> $DIR/min_match_ergonomics_fail.rs:34:20 | LL | test_pat_on_type![(ref mut x,): &mut (T,)]; - | ^^^^^^^ default binding mode is `ref mut` + | ^^^^^^^-- + | | + | this binding modifier + | default binding mode is `ref mut` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit @@ -175,7 +193,10 @@ error: reference patterns may only be written when the default binding mode is ` --> $DIR/min_match_ergonomics_fail.rs:43:10 | LL | (&x,) => x, - | ^ default binding mode is `ref` + | ^- + | | + | this reference pattern + | default binding mode is `ref` | = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> help: make the implied reference pattern explicit |
