summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-08-01 19:13:47 -0700
committerRalf Jung <post@ralfj.de>2017-08-01 19:22:23 -0700
commite92ddbf5f7b9b1c6d61f3b6138035dfd5eee2c68 (patch)
treeb3f0020860b434722293b63e656fc8f2b0643512 /src
parent640cfc852ae17d51a2f5e75fcae9a93431a3b38c (diff)
downloadrust-e92ddbf5f7b9b1c6d61f3b6138035dfd5eee2c68.tar.gz
rust-e92ddbf5f7b9b1c6d61f3b6138035dfd5eee2c68.zip
improve hir::map::Map::get_parent_node doc
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/map/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 3fdd9c34f46..45b1d6c1841 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -553,7 +553,9 @@ impl<'hir> Map<'hir> {
     }
 
     /// Similar to get_parent, returns the parent node id or id if there is no
-    /// parent.
+    /// parent. Note that the parent may be CRATE_NODE_ID, which is not itself
+    /// present in the map -- so passing the return value of get_parent_node to
+    /// get may actually panic.
     /// This function returns the immediate parent in the AST, whereas get_parent
     /// returns the enclosing item. Note that this might not be the actual parent
     /// node in the AST - some kinds of nodes are not in the map and these will
@@ -629,7 +631,7 @@ impl<'hir> Map<'hir> {
     }
 
     /// Retrieve the NodeId for `id`'s enclosing method, unless there's a
-    /// `while` or `loop` before reacing it, as block tail returns are not
+    /// `while` or `loop` before reaching it, as block tail returns are not
     /// available in them.
     ///
     /// ```