about summary refs log tree commit diff
path: root/tests/ui/pattern/pattern-bad-ref-box-order.rs
diff options
context:
space:
mode:
authorHirochika Matsumoto <hirochika.k.matsumoto@gmail.com>2023-11-27 18:28:51 +0900
committerHirochika Matsumoto <hirochika.k.matsumoto@gmail.com>2023-11-27 21:38:19 +0900
commitf4c2bdeec9d53c6a7221ebfdb2d995932dff9648 (patch)
tree81bf624c30ae20d0decbd2d91805404b8e4c75f4 /tests/ui/pattern/pattern-bad-ref-box-order.rs
parentb29a1e00f850e548f3021ea523d0e143724fa9b7 (diff)
Suggest swapping the order of `ref` and `box`
Diffstat (limited to 'tests/ui/pattern/pattern-bad-ref-box-order.rs')
-rw-r--r--tests/ui/pattern/pattern-bad-ref-box-order.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.rs b/tests/ui/pattern/pattern-bad-ref-box-order.rs
new file mode 100644
index 00000000000..f3fcf0ceacf
--- /dev/null
+++ b/tests/ui/pattern/pattern-bad-ref-box-order.rs
@@ -0,0 +1,14 @@
+// run-rustfix
+
+#![feature(box_patterns)]
+#![allow(dead_code)]
+
+fn foo(f: Option<Box<i32>>) {
+    match f {
+        Some(ref box _i) => {},
+        //~^ ERROR switch the order of `ref` and `box`
+        None => {}
+    }
+}
+
+fn main() { }