Skip to content

Commit f343e84

Browse files
committed
resolve: add type IdentMap<T> alias.
1 parent 219ddde commit f343e84

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc_resolve/late.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ mod diagnostics;
3535

3636
type Res = def::Res<NodeId>;
3737

38+
type IdentMap<T> = FxHashMap<Ident, T>;
39+
3840
/// Map from the name in a pattern to its binding mode.
39-
type BindingMap = FxHashMap<Ident, BindingInfo>;
41+
type BindingMap = IdentMap<BindingInfo>;
4042

4143
#[derive(Copy, Clone, Debug)]
4244
struct BindingInfo {
@@ -143,7 +145,7 @@ impl RibKind<'_> {
143145
/// resolving, the name is looked up from inside out.
144146
#[derive(Debug)]
145147
crate struct Rib<'a, R = Res> {
146-
pub bindings: FxHashMap<Ident, R>,
148+
pub bindings: IdentMap<R>,
147149
pub kind: RibKind<'a>,
148150
}
149151

@@ -1275,7 +1277,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
12751277
pat_id: NodeId,
12761278
outer_pat_id: NodeId,
12771279
pat_src: PatternSource,
1278-
bindings: &mut FxHashMap<Ident, NodeId>)
1280+
bindings: &mut IdentMap<NodeId>)
12791281
-> Res {
12801282
// Add the binding to the local ribs, if it
12811283
// doesn't already exist in the bindings map. (We
@@ -1323,7 +1325,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
13231325
res
13241326
}
13251327

1326-
fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut FxHashMap<Ident, Res> {
1328+
fn innermost_rib_bindings(&mut self, ns: Namespace) -> &mut IdentMap<Res> {
13271329
&mut self.ribs[ns].last_mut().unwrap().bindings
13281330
}
13291331

@@ -1332,7 +1334,7 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
13321334
pat: &Pat,
13331335
pat_src: PatternSource,
13341336
// Maps idents to the node ID for the outermost pattern that binds them.
1335-
bindings: &mut FxHashMap<Ident, NodeId>,
1337+
bindings: &mut IdentMap<NodeId>,
13361338
) {
13371339
// Visit all direct subpatterns of this pattern.
13381340
let outer_pat_id = pat.id;

0 commit comments

Comments
 (0)