about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2024-07-05 11:16:48 -0400
committerJules Bertholet <julesbertholet@quoi.xyz>2024-07-05 11:17:13 -0400
commit5a35fc446e173d7a592bb859ffda9d97e996df5b (patch)
tree332c5cd69801f4584057c4afbaa827f52323b333 /tests/ui
parent5fd5b650935c27754dcf8cef06df37c3b91818eb (diff)
downloadrust-5a35fc446e173d7a592bb859ffda9d97e996df5b.tar.gz
rust-5a35fc446e173d7a592bb859ffda9d97e996df5b.zip
Match ergonomics 2024: `&` matches `&mut` on old editions
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2021.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2021.rs b/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2021.rs
new file mode 100644
index 00000000000..afea249ffef
--- /dev/null
+++ b/tests/ui/match/ref_pat_eat_one_layer_2024/ref_pat_eat_one_layer_2021.rs
@@ -0,0 +1,15 @@
+//@ run-pass
+//@ edition: 2021
+//@ revisions: classic structural both
+#![allow(incomplete_features)]
+#![cfg_attr(any(classic, both), feature(ref_pat_eat_one_layer_2024))]
+#![cfg_attr(any(structural, both), feature(ref_pat_eat_one_layer_2024_structural))]
+
+pub fn main() {
+    if let &Some(Some(x)) = &Some(&mut Some(0)) {
+        let _: &u32 = x;
+    }
+    if let Some(&x) = Some(&mut 0) {
+        let _: u32 = x;
+    }
+}