@@ -16,7 +16,6 @@ pub use self::IntVarValue::*;
1616pub use self :: LvaluePreference :: * ;
1717pub use self :: fold:: TypeFoldable ;
1818
19- use std:: collections:: { hash_map, HashMap } ;
2019use dep_graph:: { self , DepNode } ;
2120use hir:: map as ast_map;
2221use middle;
@@ -31,7 +30,7 @@ use ty::subst::{Subst, Substs};
3130use ty:: walk:: TypeWalker ;
3231use util:: common:: MemoizationMap ;
3332use util:: nodemap:: NodeSet ;
34- use util:: nodemap:: FxHashMap ;
33+ use util:: nodemap:: { FxHashMap , FxHashSet } ;
3534
3635use serialize:: { self , Encodable , Encoder } ;
3736use std:: borrow:: Cow ;
@@ -1393,13 +1392,12 @@ impl<'tcx> serialize::UseSpecializedDecodable for AdtDef<'tcx> {}
13931392impl < ' a , ' gcx , ' tcx > AdtDefData < ' tcx , ' static > {
13941393 #[ inline]
13951394 pub fn is_uninhabited_recurse ( & ' tcx self ,
1396- visited : & mut HashMap < ( DefId , & ' tcx Substs < ' tcx > ) , ( ) > ,
1395+ visited : & mut FxHashSet < ( DefId , & ' tcx Substs < ' tcx > ) > ,
13971396 block : Option < NodeId > ,
13981397 cx : TyCtxt < ' a , ' gcx , ' tcx > ,
13991398 substs : & ' tcx Substs < ' tcx > ) -> bool {
1400- match visited. entry ( ( self . did , substs) ) {
1401- hash_map:: Entry :: Occupied ( _) => return false ,
1402- hash_map:: Entry :: Vacant ( ve) => ve. insert ( ( ) ) ,
1399+ if !visited. insert ( ( self . did , substs) ) {
1400+ return false ;
14031401 } ;
14041402 self . variants . iter ( ) . all ( |v| {
14051403 v. is_uninhabited_recurse ( visited, block, cx, substs, self . is_union ( ) )
@@ -1811,7 +1809,7 @@ impl<'tcx, 'container> VariantDefData<'tcx, 'container> {
18111809impl < ' a , ' gcx , ' tcx > VariantDefData < ' tcx , ' static > {
18121810 #[ inline]
18131811 pub fn is_uninhabited_recurse ( & ' tcx self ,
1814- visited : & mut HashMap < ( DefId , & ' tcx Substs < ' tcx > ) , ( ) > ,
1812+ visited : & mut FxHashSet < ( DefId , & ' tcx Substs < ' tcx > ) > ,
18151813 block : Option < NodeId > ,
18161814 cx : TyCtxt < ' a , ' gcx , ' tcx > ,
18171815 substs : & ' tcx Substs < ' tcx > ,
@@ -1852,7 +1850,7 @@ impl<'a, 'gcx, 'tcx, 'container> FieldDefData<'tcx, 'container> {
18521850impl < ' a , ' gcx , ' tcx > FieldDefData < ' tcx , ' static > {
18531851 #[ inline]
18541852 pub fn is_uninhabited_recurse ( & ' tcx self ,
1855- visited : & mut HashMap < ( DefId , & ' tcx Substs < ' tcx > ) , ( ) > ,
1853+ visited : & mut FxHashSet < ( DefId , & ' tcx Substs < ' tcx > ) > ,
18561854 block : Option < NodeId > ,
18571855 tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
18581856 substs : & ' tcx Substs < ' tcx > ) -> bool {
0 commit comments