We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cc403b6 + 6252af9 commit 1ad89e0Copy full SHA for 1ad89e0
src/librustc_trans/save/dump_csv.rs
@@ -107,8 +107,17 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
107
}
108
109
pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
110
+ let source_file = self.tcx.sess.local_crate_source_file.as_ref();
111
+ let crate_root = match source_file {
112
+ Some(source_file) => match source_file.file_name() {
113
+ Some(_) => source_file.parent().unwrap().display().to_string(),
114
+ None => source_file.display().to_string(),
115
+ },
116
+ None => "<no source>".to_owned(),
117
+ };
118
+
119
// The current crate.
- self.fmt.crate_str(krate.span, name);
120
+ self.fmt.crate_str(krate.span, name, &crate_root);
121
122
// Dump info about all the external crates referenced from this crate.
123
for c in &self.save_ctxt.get_external_crates() {
src/librustc_trans/save/recorder.rs
@@ -198,7 +198,7 @@ impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> {
198
vec!("name", "crate", "file_name"),
199
false,
200
false),
201
- Crate => ("crate", vec!("name"), true, false),
+ Crate => ("crate", vec!("name", "crate_root"), true, false),
202
FnCall => ("fn_call",
203
vec!("refid", "refidcrate", "qualname", "scopeid"),
204
true,
@@ -658,8 +658,8 @@ impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> {
658
self.check_and_record(Typedef, span, sub_span, svec!(id, qualname, value));
659
660
661
- pub fn crate_str(&mut self, span: Span, name: &str) {
662
- self.record_with_span(Crate, span, span, svec!(name));
+ pub fn crate_str(&mut self, span: Span, name: &str, crate_root: &str) {
+ self.record_with_span(Crate, span, span, svec!(name, crate_root));
663
664
665
pub fn external_crate_str(&mut self, span: Span, name: &str, num: ast::CrateNum) {
0 commit comments