From b4587fb281d3066e4591a5067e2fa9a79df272aa Mon Sep 17 00:00:00 2001 From: David Faust Date: Thu, 20 Jan 2022 12:43:51 -0800 Subject: Record correct location when compiling ADT types When compiling ADTTypes, the wrong HirId was being used for location lookup. This produced an issue where the gimple dump would not write type names for struct and union types, because they were mistaken for built-in types. Also add new test testsuite/rust/compile/torture/struct_decl.rs. Fixes: #877 --- gcc/rust/backend/rust-compile-type.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/rust/backend') 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; -- cgit v1.1