Auto merge of #29550 - nrc:save-root, r=alexcrichton
This commit is contained in:
commit
1ad89e0de6
2 changed files with 13 additions and 4 deletions
|
@ -107,8 +107,17 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
|
pub fn dump_crate_info(&mut self, name: &str, krate: &ast::Crate) {
|
||||||
|
let source_file = self.tcx.sess.local_crate_source_file.as_ref();
|
||||||
|
let crate_root = match source_file {
|
||||||
|
Some(source_file) => match source_file.file_name() {
|
||||||
|
Some(_) => source_file.parent().unwrap().display().to_string(),
|
||||||
|
None => source_file.display().to_string(),
|
||||||
|
},
|
||||||
|
None => "<no source>".to_owned(),
|
||||||
|
};
|
||||||
|
|
||||||
// The current crate.
|
// The current crate.
|
||||||
self.fmt.crate_str(krate.span, name);
|
self.fmt.crate_str(krate.span, name, &crate_root);
|
||||||
|
|
||||||
// Dump info about all the external crates referenced from this crate.
|
// Dump info about all the external crates referenced from this crate.
|
||||||
for c in &self.save_ctxt.get_external_crates() {
|
for c in &self.save_ctxt.get_external_crates() {
|
||||||
|
|
|
@ -198,7 +198,7 @@ impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> {
|
||||||
vec!("name", "crate", "file_name"),
|
vec!("name", "crate", "file_name"),
|
||||||
false,
|
false,
|
||||||
false),
|
false),
|
||||||
Crate => ("crate", vec!("name"), true, false),
|
Crate => ("crate", vec!("name", "crate_root"), true, false),
|
||||||
FnCall => ("fn_call",
|
FnCall => ("fn_call",
|
||||||
vec!("refid", "refidcrate", "qualname", "scopeid"),
|
vec!("refid", "refidcrate", "qualname", "scopeid"),
|
||||||
true,
|
true,
|
||||||
|
@ -658,8 +658,8 @@ impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> {
|
||||||
self.check_and_record(Typedef, span, sub_span, svec!(id, qualname, value));
|
self.check_and_record(Typedef, span, sub_span, svec!(id, qualname, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn crate_str(&mut self, span: Span, name: &str) {
|
pub fn crate_str(&mut self, span: Span, name: &str, crate_root: &str) {
|
||||||
self.record_with_span(Crate, span, span, svec!(name));
|
self.record_with_span(Crate, span, span, svec!(name, crate_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn external_crate_str(&mut self, span: Span, name: &str, num: ast::CrateNum) {
|
pub fn external_crate_str(&mut self, span: Span, name: &str, num: ast::CrateNum) {
|
||||||
|
|
Loading…
Reference in a new issue