diff options
| author | bors <bors@rust-lang.org> | 2017-11-02 12:34:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-11-02 12:34:13 +0000 |
| commit | 5ce3d482e2313fe6795e6d688e62a092af424da8 (patch) | |
| tree | 7e3956c51e647bd38351601f42cc71f5332aa8df | |
| parent | a7d98c78377e5083d5add5d3ae8d26ffa938c005 (diff) | |
| parent | a9bafe5c9ee8ce0d20634898e59aed4eb965f343 (diff) | |
| download | rust-5ce3d482e2313fe6795e6d688e62a092af424da8.tar.gz rust-5ce3d482e2313fe6795e6d688e62a092af424da8.zip | |
Auto merge of #45647 - nrc:rls-bugs, r=eddyb
save-analysis: support unions r? @eddyb
| -rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 11 | ||||
| -rw-r--r-- | src/test/run-make/save-analysis/foo.rs | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 2658ba22e7d..dcce714e542 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -558,8 +558,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { if !self.span.filter_generated(sub_span, item.span) { let span = self.span_from_span(sub_span.expect("No span found for struct")); + let kind = match item.node { + ast::ItemKind::Struct(_, _) => DefKind::Struct, + ast::ItemKind::Union(_, _) => DefKind::Union, + _ => unreachable!(), + }; self.dumper.dump_def(item.vis == ast::Visibility::Public, Def { - kind: DefKind::Struct, + kind, id: ::id_from_node_id(item.id, &self.save_ctxt), span, name, @@ -1216,7 +1221,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc self.process_static_or_const_item(item, typ, expr), Const(ref typ, ref expr) => self.process_static_or_const_item(item, &typ, &expr), - Struct(ref def, ref ty_params) => self.process_struct(item, def, ty_params), + Struct(ref def, ref ty_params) | Union(ref def, ref ty_params) => { + self.process_struct(item, def, ty_params) + } Enum(ref def, ref ty_params) => self.process_enum(item, def, ty_params), Impl(.., ref ty_params, diff --git a/src/test/run-make/save-analysis/foo.rs b/src/test/run-make/save-analysis/foo.rs index 5cb363ac344..834a7554a55 100644 --- a/src/test/run-make/save-analysis/foo.rs +++ b/src/test/run-make/save-analysis/foo.rs @@ -441,6 +441,11 @@ fn test_format_args() { print!("x is {}, y is {1}, name is {n}", x, y, n = name); } + +union TestUnion { + f1: u32 +} + struct FrameBuffer; struct SilenceGenerator; |
