]> git.lizzy.rs Git - rust.git/commitdiff
Change HashSet element type to `DefId`
authorShotaro Yamada <sinkuu@sinkuu.xyz>
Wed, 16 Oct 2019 04:46:44 +0000 (13:46 +0900)
committerShotaro Yamada <sinkuu@sinkuu.xyz>
Wed, 16 Oct 2019 04:46:44 +0000 (13:46 +0900)
src/librustc_mir/hair/pattern/mod.rs

index 58d741b9295a3b209dd4652b75a50f5996f8fcfe..72e6970ebba128af7f09e62db5bccbb39c06fe7b 100644 (file)
@@ -1217,7 +1217,7 @@ struct Search<'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 visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
                 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