Change HashSet element type to DefId

This commit is contained in:
Shotaro Yamada 2019-10-16 13:46:44 +09:00
parent e369d87b01
commit d5ffd36a6c

View file

@ -1217,7 +1217,7 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
// tracks ADT's previously encountered during search, so that
// we will not recur on them again.
seen: FxHashSet<&'tcx AdtDef>,
seen: FxHashSet<hir::def_id::DefId>,
}
impl<'tcx> TypeVisitor<'tcx> for Search<'tcx> {
@ -1257,14 +1257,12 @@ fn search_for_adt_without_structural_match<'tcx>(tcx: TyCtxt<'tcx>,
return true // Halt visiting!
}
if self.seen.contains(adt_def) {
if !self.seen.insert(adt_def.did) {
debug!("Search already seen adt_def: {:?}", adt_def);
// let caller continue its search
return false;
}
self.seen.insert(adt_def);
// `#[structural_match]` does not care about the
// instantiation of the generics in an ADT (it
// instead looks directly at its fields outside