Skip to content

Commit 52fd69c

Browse files
committed
save-analysis: add references to paths to get_path_data
1 parent 82d40cb commit 52fd69c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/librustc_trans/save/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ pub enum Data {
6363
VariableRefData(VariableRefData),
6464
/// Data for a reference to a type or trait.
6565
TypeRefData(TypeRefData),
66+
/// Data for a reference to a module.
67+
ModRefData(ModRefData),
6668
/// Data about a function call.
6769
FunctionCallData(FunctionCallData),
6870
/// Data about a method call.
@@ -143,6 +145,14 @@ pub struct TypeRefData {
143145
pub ref_id: DefId,
144146
}
145147

148+
/// Data for a reference to a module.
149+
#[derive(Debug)]
150+
pub struct ModRefData {
151+
pub span: Span,
152+
pub scope: NodeId,
153+
pub ref_id: DefId,
154+
}
155+
146156
/// Data about a function call.
147157
#[derive(Debug)]
148158
pub struct FunctionCallData {
@@ -585,6 +595,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
585595
scope: self.enclosing_scope(id),
586596
})
587597
}
598+
def::DefMod(def_id) => {
599+
Data::ModRefData(ModRefData {
600+
ref_id: def_id,
601+
span: sub_span.unwrap(),
602+
scope: self.enclosing_scope(id),
603+
})
604+
}
588605
_ => self.tcx.sess.span_bug(path.span,
589606
&format!("Unexpected def kind while looking \
590607
up path in `{}`: `{:?}`",

0 commit comments

Comments
 (0)