From cb0863475f53854114a1ebcebc02d9cd82d3dd95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Wed, 29 Nov 2023 18:25:16 +0000 Subject: [PATCH] fix rebase --- .../pattern/pattern-bad-ref-box-order.fixed | 4 +++- tests/ui/pattern/pattern-bad-ref-box-order.rs | 2 ++ .../pattern/pattern-bad-ref-box-order.stderr | 20 ++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.fixed b/tests/ui/pattern/pattern-bad-ref-box-order.fixed index 8825744a08b1d..e99ab449a6cfc 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.fixed +++ b/tests/ui/pattern/pattern-bad-ref-box-order.fixed @@ -5,8 +5,10 @@ fn foo(f: Option>) { match f { - Some(box ref _i) => {}, + Some(box ref, _i) => {}, //~^ ERROR switch the order of `ref` and `box` + //~| ERROR expected one of `)`, `,`, or `|`, found `_i` + //~| ERROR this pattern has 2 fields, but the corresponding tuple variant has 1 field None => {} } } diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.rs b/tests/ui/pattern/pattern-bad-ref-box-order.rs index f3fcf0ceacf0b..3632bb438de0f 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.rs +++ b/tests/ui/pattern/pattern-bad-ref-box-order.rs @@ -7,6 +7,8 @@ fn foo(f: Option>) { match f { Some(ref box _i) => {}, //~^ ERROR switch the order of `ref` and `box` + //~| ERROR expected one of `)`, `,`, or `|`, found `_i` + //~| ERROR this pattern has 2 fields, but the corresponding tuple variant has 1 field None => {} } } diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.stderr b/tests/ui/pattern/pattern-bad-ref-box-order.stderr index a49f05c1028d8..0d3ab6394469c 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.stderr +++ b/tests/ui/pattern/pattern-bad-ref-box-order.stderr @@ -4,5 +4,23 @@ error: switch the order of `ref` and `box` LL | Some(ref box _i) => {}, | ^^^^^^^ help: swap them: `box ref` -error: aborting due to 1 previous error +error: expected one of `)`, `,`, or `|`, found `_i` + --> $DIR/pattern-bad-ref-box-order.rs:8:22 + | +LL | Some(ref box _i) => {}, + | -^^ expected one of `)`, `,`, or `|` + | | + | help: missing `,` + +error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field + --> $DIR/pattern-bad-ref-box-order.rs:8:22 + | +LL | Some(ref box _i) => {}, + | ^^ expected 1 field, found 2 + --> $SRC_DIR/core/src/option.rs:LL:COL + | + = note: tuple variant has 1 field + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0023`.