about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-07-25 17:05:34 +1200
committerNick Cameron <ncameron@mozilla.com>2015-07-25 17:05:34 +1200
commit52fd69c9332b1cddd1a778cf96ff432cfcad5beb (patch)
treef908b30282606af160f00ba8a9f1b23bf0c331bb
parent82d40cb2ba44a27b7db8ec185b5c532237db4b3e (diff)
downloadrust-52fd69c9332b1cddd1a778cf96ff432cfcad5beb.tar.gz
rust-52fd69c9332b1cddd1a778cf96ff432cfcad5beb.zip
save-analysis: add references to paths to get_path_data
-rw-r--r--src/librustc_trans/save/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs
index 26da803de65..077284a7c42 100644
--- a/src/librustc_trans/save/mod.rs
+++ b/src/librustc_trans/save/mod.rs
@@ -63,6 +63,8 @@ pub enum Data {
     VariableRefData(VariableRefData),
     /// Data for a reference to a type or trait.
     TypeRefData(TypeRefData),
+    /// Data for a reference to a module.
+    ModRefData(ModRefData),
     /// Data about a function call.
     FunctionCallData(FunctionCallData),
     /// Data about a method call.
@@ -143,6 +145,14 @@ pub struct TypeRefData {
     pub ref_id: DefId,
 }
 
+/// Data for a reference to a module.
+#[derive(Debug)]
+pub struct ModRefData {
+    pub span: Span,
+    pub scope: NodeId,
+    pub ref_id: DefId,
+}
+
 /// Data about a function call.
 #[derive(Debug)]
 pub struct FunctionCallData {
@@ -585,6 +595,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                     scope: self.enclosing_scope(id),
                 })
             }
+            def::DefMod(def_id) => {
+                Data::ModRefData(ModRefData {
+                    ref_id: def_id,
+                    span: sub_span.unwrap(),
+                    scope: self.enclosing_scope(id),
+                })
+            }
             _ => self.tcx.sess.span_bug(path.span,
                                         &format!("Unexpected def kind while looking \
                                                   up path in `{}`: `{:?}`",