11//! Name resolution for expressions.
22use hir_expand:: name:: Name ;
3- use la_arena:: { Arena , Idx , IdxRange , RawIdx } ;
4- use rustc_hash:: FxHashMap ;
3+ use la_arena:: { Arena , ArenaMap , Idx , IdxRange , RawIdx } ;
54use triomphe:: Arc ;
65
76use crate :: {
@@ -17,7 +16,7 @@ pub type ScopeId = Idx<ScopeData>;
1716pub struct ExprScopes {
1817 scopes : Arena < ScopeData > ,
1918 scope_entries : Arena < ScopeEntry > ,
20- scope_by_expr : FxHashMap < ExprId , ScopeId > ,
19+ scope_by_expr : ArenaMap < ExprId , ScopeId > ,
2120}
2221
2322#[ derive( Debug , PartialEq , Eq ) ]
@@ -77,10 +76,10 @@ impl ExprScopes {
7776 }
7877
7978 pub fn scope_for ( & self , expr : ExprId ) -> Option < ScopeId > {
80- self . scope_by_expr . get ( & expr) . copied ( )
79+ self . scope_by_expr . get ( expr) . copied ( )
8180 }
8281
83- pub fn scope_by_expr ( & self ) -> & FxHashMap < ExprId , ScopeId > {
82+ pub fn scope_by_expr ( & self ) -> & ArenaMap < ExprId , ScopeId > {
8483 & self . scope_by_expr
8584 }
8685}
@@ -94,7 +93,7 @@ impl ExprScopes {
9493 let mut scopes = ExprScopes {
9594 scopes : Arena :: default ( ) ,
9695 scope_entries : Arena :: default ( ) ,
97- scope_by_expr : FxHashMap :: default ( ) ,
96+ scope_by_expr : ArenaMap :: with_capacity ( body . exprs . len ( ) ) ,
9897 } ;
9998 let mut root = scopes. root_scope ( ) ;
10099 scopes. add_params_bindings ( body, root, & body. params ) ;
0 commit comments