Skip to content

Commit

Permalink
save-analysis: only emit type in the value for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Sep 7, 2016
1 parent ce413e0 commit 493544a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/librustc_save_analysis/dump_visitor.rs
Expand Up @@ -1427,11 +1427,15 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
for &(id, ref p, immut, ref_kind) in &collector.collected_paths {
match self.tcx.expect_def(id) {
Def::Local(_, id) => {
let value = if immut == ast::Mutability::Immutable {
let mut value = if immut == ast::Mutability::Immutable {
self.span.snippet(p.span).to_string()
} else {
"<mutable>".to_string()
};
let typ = self.tcx.node_types()
.get(&id).map(|t| t.to_string()).unwrap_or(String::new());
value.push_str(": ");
value.push_str(&typ);

assert!(p.segments.len() == 1,
"qualified path for local variable def in arm");
Expand All @@ -1443,7 +1447,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
name: path_to_string(p),
qualname: format!("{}${}", path_to_string(p), id),
value: value,
type_value: String::new(),
type_value: typ,
scope: 0,
parent: None,
visibility: Visibility::Inherited,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/json_dumper.rs
Expand Up @@ -380,7 +380,7 @@ impl From<VariableData> for Def {
span: data.span,
name: data.name,
qualname: data.qualname,
value: data.value,
value: data.type_value,
children: vec![],
decl_id: None,
docs: data.docs,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_save_analysis/lib.rs
Expand Up @@ -749,7 +749,6 @@ impl Visitor for PathCollector {
}
}


fn docs_for_attrs(attrs: &[Attribute]) -> String {
let doc = InternedString::new("doc");
let mut result = String::new();
Expand Down

0 comments on commit 493544a

Please sign in to comment.