]> git.lizzy.rs Git - rust.git/commitdiff
Merge tuple and struct pattern generation.
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 3 Apr 2020 13:22:37 +0000 (15:22 +0200)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Sun, 20 Sep 2020 10:31:37 +0000 (12:31 +0200)
compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

index 2816bad7eabc1cc0c8bd16f7c46c7e085b65d24d..55b583842981048c5bd155096285f2ba2da41512 100644 (file)
@@ -279,11 +279,7 @@ fn recur(&self, cv: &'tcx ty::Const<'tcx>) -> Pat<'tcx> {
                     subpatterns: field_pats(destructured.fields),
                 }
             }
-            ty::Adt(_, _) => {
-                let destructured = tcx.destructure_const(param_env.and(cv));
-                PatKind::Leaf { subpatterns: field_pats(destructured.fields) }
-            }
-            ty::Tuple(_) => {
+            ty::Tuple(_) | ty::Adt(_, _) => {
                 let destructured = tcx.destructure_const(param_env.and(cv));
                 PatKind::Leaf { subpatterns: field_pats(destructured.fields) }
             }