diff options
| author | Jules Bertholet <julesbertholet@quoi.xyz> | 2024-07-05 11:16:48 -0400 |
|---|---|---|
| committer | Jules Bertholet <julesbertholet@quoi.xyz> | 2024-07-05 11:17:13 -0400 |
| commit | 5a35fc446e173d7a592bb859ffda9d97e996df5b (patch) | |
| tree | 332c5cd69801f4584057c4afbaa827f52323b333 /tests/ui | |
| parent | 5fd5b650935c27754dcf8cef06df37c3b91818eb (diff) | |
| download | rust-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.rs | 15 |
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; + } +} |
