Skip to content

Commit f3ebfab

Browse files
pnkfelixMark-Simulacrum
authored andcommitted
Make fn ptr always structural match, regardless of whether formal types are.
Fix rust-lang#63479.
1 parent d8052d8 commit f3ebfab

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
@@ -1203,7 +1203,13 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
12031203
ty::RawPtr(..) => {
12041204
// `#[structural_match]` ignores substructure of
12051205
// `*const _`/`*mut _`, so skip super_visit_with
1206-
1206+
//
1207+
// (But still tell caller to continue search.)
1208+
return false;
1209+
}
1210+
ty::FnDef(..) | ty::FnPtr(..) => {
1211+
// types of formals and return in `fn(_) -> _` are also irrelevant
1212+
//
12071213
// (But still tell caller to continue search.)
12081214
return false;
12091215
}

0 commit comments

Comments
 (0)