X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_resolve%2Flib.rs;h=8f920e792b33c9e42aca873c7d4bb9fd4a0155ff;hb=efa3ec67e28ab8a4c3377a039095cd464713cdfd;hp=2183c9124e7f4367d9390f7651d63dda95b48332;hpb=63cc2dda63b7f26933fcb2324ff2274f7fbfec30;p=rust.git diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 2183c9124e7..8f920e792b3 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1443,7 +1443,7 @@ pub fn new(session: &'a Session, def_map: NodeMap(), freevars: NodeMap(), freevars_seen: NodeMap(), - export_map: NodeMap(), + export_map: FxHashMap(), trait_map: NodeMap(), module_map, block_map: NodeMap(), @@ -2291,7 +2291,7 @@ fn fresh_binding(&mut self, // must not add it if it's in the bindings map // because that breaks the assumptions later // passes make about or-patterns.) - let mut def = Def::Local(self.definitions.local_def_id(pat_id)); + let mut def = Def::Local(pat_id); match bindings.get(&ident.node).cloned() { Some(id) if id == outer_pat_id => { // `Variant(a, a)`, error @@ -2946,7 +2946,7 @@ fn adjust_local_def(&mut self, Def::Upvar(..) => { span_bug!(span, "unexpected {:?} in bindings", def) } - Def::Local(def_id) => { + Def::Local(node_id) => { for rib in ribs { match rib.kind { NormalRibKind | ModuleRibKind(..) | MacroDefinition(..) | @@ -2955,20 +2955,19 @@ fn adjust_local_def(&mut self, } ClosureRibKind(function_id) => { let prev_def = def; - let node_id = self.definitions.as_local_node_id(def_id).unwrap(); let seen = self.freevars_seen .entry(function_id) .or_insert_with(|| NodeMap()); if let Some(&index) = seen.get(&node_id) { - def = Def::Upvar(def_id, index, function_id); + def = Def::Upvar(node_id, index, function_id); continue; } let vec = self.freevars .entry(function_id) .or_insert_with(|| vec![]); let depth = vec.len(); - def = Def::Upvar(def_id, depth, function_id); + def = Def::Upvar(node_id, depth, function_id); if record_used { vec.push(Freevar { @@ -3043,7 +3042,7 @@ fn extract_node_id(t: &Ty) -> Option { } // Fields are generally expected in the same contexts as locals. - if filter_fn(Def::Local(DefId::local(CRATE_DEF_INDEX))) { + if filter_fn(Def::Local(ast::DUMMY_NODE_ID)) { if let Some(node_id) = self.current_self_type.as_ref().and_then(extract_node_id) { // Look for a field with the same name in the current self_type. if let Some(resolution) = self.def_map.get(&node_id) {