Skip to content

Commit

Permalink
Revert crate root changes
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Aug 27, 2018
1 parent 6642462 commit a9d075e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/librustc/hir/map/mod.rs
Expand Up @@ -561,7 +561,13 @@ impl<'hir> Map<'hir> {
/// Retrieve the Node corresponding to `id`, returning None if
/// cannot be found.
pub fn find(&self, id: NodeId) -> Option<Node<'hir>> {
let result = self.find_entry(id).map(|x| x.node);
let result = self.find_entry(id).and_then(|entry| {
if let Node::Crate = entry.node {
None
} else {
Some(entry.node)
}
});
if result.is_some() {
self.read(id);
}
Expand Down Expand Up @@ -632,6 +638,9 @@ impl<'hir> Map<'hir> {
}

if let Some(entry) = self.find_entry(parent_node) {
if let Node::Crate = entry.node {
return Err(id);
}
if found(&entry.node) {
return Ok(parent_node);
} else if bail_early(&entry.node) {
Expand Down

0 comments on commit a9d075e

Please sign in to comment.