Auto merge of #45647 - nrc:rls-bugs, r=eddyb

save-analysis: support unions

r? @eddyb
This commit is contained in:
bors 2017-11-02 12:34:13 +00:00
commit 5ce3d482e2
2 changed files with 14 additions and 2 deletions

View file

@ -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,

View file

@ -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;