Skip to content

Commit 493544a

Browse files
committed
save-analysis: only emit type in the value for variables
1 parent ce413e0 commit 493544a

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,11 +1427,15 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
14271427
for &(id, ref p, immut, ref_kind) in &collector.collected_paths {
14281428
match self.tcx.expect_def(id) {
14291429
Def::Local(_, id) => {
1430-
let value = if immut == ast::Mutability::Immutable {
1430+
let mut value = if immut == ast::Mutability::Immutable {
14311431
self.span.snippet(p.span).to_string()
14321432
} else {
14331433
"<mutable>".to_string()
14341434
};
1435+
let typ = self.tcx.node_types()
1436+
.get(&id).map(|t| t.to_string()).unwrap_or(String::new());
1437+
value.push_str(": ");
1438+
value.push_str(&typ);
14351439

14361440
assert!(p.segments.len() == 1,
14371441
"qualified path for local variable def in arm");
@@ -1443,7 +1447,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor for DumpVisitor<'l, 'tcx, 'll, D>
14431447
name: path_to_string(p),
14441448
qualname: format!("{}${}", path_to_string(p), id),
14451449
value: value,
1446-
type_value: String::new(),
1450+
type_value: typ,
14471451
scope: 0,
14481452
parent: None,
14491453
visibility: Visibility::Inherited,

src/librustc_save_analysis/json_dumper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl From<VariableData> for Def {
380380
span: data.span,
381381
name: data.name,
382382
qualname: data.qualname,
383-
value: data.value,
383+
value: data.type_value,
384384
children: vec![],
385385
decl_id: None,
386386
docs: data.docs,

src/librustc_save_analysis/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,6 @@ impl Visitor for PathCollector {
749749
}
750750
}
751751

752-
753752
fn docs_for_attrs(attrs: &[Attribute]) -> String {
754753
let doc = InternedString::new("doc");
755754
let mut result = String::new();

0 commit comments

Comments
 (0)