diff --git a/src/librustc_trans/save/mod.rs b/src/librustc_trans/save/mod.rs index 26da803de655..077284a7c422 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 `{}`: `{:?}`",