Skip to content

Commit 7437f77

Browse files
committed
Make fn ptr always structural match, regardless of whether formal types are.
Fix #63479.
1 parent 1e86913 commit 7437f77

File tree

1 file changed

+7
-1
lines changed
  • src/librustc_mir/hair/pattern

1 file changed

+7
-1
lines changed

src/librustc_mir/hair/pattern/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,13 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
12291229
ty::RawPtr(..) => {
12301230
// `#[structural_match]` ignores substructure of
12311231
// `*const _`/`*mut _`, so skip super_visit_with
1232-
1232+
//
1233+
// (But still tell caller to continue search.)
1234+
return false;
1235+
}
1236+
ty::FnDef(..) | ty::FnPtr(..) => {
1237+
// types of formals and return in `fn(_) -> _` are also irrelevant
1238+
//
12331239
// (But still tell caller to continue search.)
12341240
return false;
12351241
}

0 commit comments

Comments
 (0)