diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index d3e3998360b6..67a4d71d90c1 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -466,7 +466,11 @@ impl Definitions { } pub fn find_node_for_hir_id(&self, hir_id: hir::HirId) -> ast::NodeId { - self.node_to_hir_id.binary_search(&hir_id).unwrap() + self.node_to_hir_id + .iter() + .position(|x| *x == hir_id) + .map(|idx| ast::NodeId::new(idx)) + .unwrap() } /// Add a definition with a parent definition.