about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2019-09-13 17:06:09 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2019-09-13 17:06:09 +0200
commit7437f770251f6c3c76f75891d48db4d1e26fc0c2 (patch)
tree48ce999a4ca079cba318c4b2625e1090f7d059ed
parent1e869133b9888dc5abde54f4f31cb797ed9c7874 (diff)
downloadrust-7437f770251f6c3c76f75891d48db4d1e26fc0c2.tar.gz
rust-7437f770251f6c3c76f75891d48db4d1e26fc0c2.zip
Make fn ptr always structural match, regardless of whether formal types are.
Fix #63479.
-rw-r--r--src/librustc_mir/hair/pattern/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs
index 6caccfddfa4..4aaa5e8ee25 100644
--- a/src/librustc_mir/hair/pattern/mod.rs
+++ b/src/librustc_mir/hair/pattern/mod.rs
@@ -1229,7 +1229,13 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
                 ty::RawPtr(..) => {
                     // `#[structural_match]` ignores substructure of
                     // `*const _`/`*mut _`, so skip super_visit_with
-
+                    //
+                    // (But still tell caller to continue search.)
+                    return false;
+                }
+                ty::FnDef(..) | ty::FnPtr(..) => {
+                    // types of formals and return in `fn(_) -> _` are also irrelevant
+                    //
                     // (But still tell caller to continue search.)
                     return false;
                 }