diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-type.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/torture/struct_decl.rs | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc index d7a8ae5..708f850 100644 --- a/gcc/rust/backend/rust-compile-type.cc +++ b/gcc/rust/backend/rust-compile-type.cc @@ -281,7 +281,7 @@ TyTyResolveCompile::visit (const TyTy::ADTType &type) tree named_struct = ctx->get_backend ()->named_type (type.get_name (), type_record, ctx->get_mappings ()->lookup_location ( - type.get_ty_ref ())); + type.get_ref ())); ctx->push_type (named_struct); translated = named_struct; diff --git a/gcc/testsuite/rust/compile/torture/struct_decl.rs b/gcc/testsuite/rust/compile/torture/struct_decl.rs new file mode 100644 index 0000000..3966928 --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/struct_decl.rs @@ -0,0 +1,14 @@ +// { dg-additional-options -fdump-tree-gimple } + +struct Foo { + a: u16, +// { dg-warning "field is never read" "" { target *-*-* } .-1 } + b: u8, +// { dg-warning "field is never read" "" { target *-*-* } .-1 } +} + +fn main() { + let my_foo = Foo { a: 1, b: 2 }; + // { dg-warning "unused name" "" { target *-*-* } .-1 } + // { dg-final { scan-tree-dump-times {(?n)const struct Foo my_foo;$} 1 gimple } } +} |