From cd2287e2bcc2ed9fbf7806b7dac390c4150b0c55 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Fri, 22 Jan 2016 18:53:23 +1300 Subject: [PATCH] save-analysis: emit the right kind of variant --- src/librustc_trans/save/dump_csv.rs | 30 +++++++++++++++++++++-------- src/librustc_trans/save/recorder.rs | 3 +-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/librustc_trans/save/dump_csv.rs b/src/librustc_trans/save/dump_csv.rs index b109353fac0..a6f8e3f10f1 100644 --- a/src/librustc_trans/save/dump_csv.rs +++ b/src/librustc_trans/save/dump_csv.rs @@ -510,14 +510,28 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> { qualname.push_str(name); let val = self.span.snippet(variant.span); - self.fmt.struct_variant_str(variant.span, - self.span.span_for_first_ident(variant.span), - variant.node.data.id(), - variant.node.data.id(), - &qualname, - &enum_data.qualname, - &val, - enum_data.id); + match variant.node.data { + ast::VariantData::Struct(..) => { + self.fmt.struct_variant_str(variant.span, + self.span.span_for_first_ident(variant.span), + variant.node.data.id(), + &qualname, + &enum_data.qualname, + &val, + enum_data.scope); + } + _ => { + self.fmt.tuple_variant_str(variant.span, + self.span.span_for_first_ident(variant.span), + variant.node.data.id(), + name, + &qualname, + &enum_data.qualname, + &val, + enum_data.scope); + } + } + for field in variant.node.data.fields() { self.process_struct_field_def(field, variant.node.data.id()); diff --git a/src/librustc_trans/save/recorder.rs b/src/librustc_trans/save/recorder.rs index 1db31baf30d..17fdbe2e839 100644 --- a/src/librustc_trans/save/recorder.rs +++ b/src/librustc_trans/save/recorder.rs @@ -433,14 +433,13 @@ impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> { span: Span, sub_span: Option, id: NodeId, - ctor_id: NodeId, name: &str, typ: &str, val: &str, scope_id: NodeId) { let id = self.normalize_node_id(id); + let ctor_id = id; let scope_id = self.normalize_node_id(scope_id); - let ctor_id = self.normalize_node_id(ctor_id); self.check_and_record(VariantStruct, span, sub_span,