aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2024-11-05 17:41:44 +0000
committerPhilip Herron <philip.herron@embecosm.com>2024-11-05 18:34:21 +0000
commite82d79c4f39b62550769525b9dec4ce446c2c96f (patch)
tree644b0471e20244b8ba7e53843e0e2d79a814de5a /gcc/rust
parentdfbd71a9ed79a121d380f5240b5a72b3175c20a4 (diff)
downloadgcc-e82d79c4f39b62550769525b9dec4ce446c2c96f.zip
gcc-e82d79c4f39b62550769525b9dec4ce446c2c96f.tar.gz
gcc-e82d79c4f39b62550769525b9dec4ce446c2c96f.tar.bz2
gccrs: fix typechecking of Fn trait calls using ADT types
Fixes RustGcc#2953 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): fix the ty_id gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle these * rust/compile/issue-2953-1.rs: New test. * rust/compile/issue-2953-2.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-item.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc
index 7bbe1e6..51ce827 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-item.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc
@@ -231,7 +231,8 @@ TypeCheckItem::visit (HIR::TupleStruct &struct_decl)
= parse_repr_options (attrs, struct_decl.get_locus ());
auto *type = new TyTy::ADTType (
- struct_decl.get_mappings ().get_hirid (), mappings.get_next_hir_id (),
+ struct_decl.get_mappings ().get_hirid (),
+ struct_decl.get_mappings ().get_hirid (),
struct_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::TUPLE_STRUCT, std::move (variants),
std::move (substitutions), repr,
@@ -312,7 +313,8 @@ TypeCheckItem::visit (HIR::StructStruct &struct_decl)
= parse_repr_options (attrs, struct_decl.get_locus ());
auto *type = new TyTy::ADTType (
- struct_decl.get_mappings ().get_hirid (), mappings.get_next_hir_id (),
+ struct_decl.get_mappings ().get_hirid (),
+ struct_decl.get_mappings ().get_hirid (),
struct_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::STRUCT_STRUCT, std::move (variants),
std::move (substitutions), repr,
@@ -369,7 +371,7 @@ TypeCheckItem::visit (HIR::Enum &enum_decl)
// multi variant ADT
auto *type
= new TyTy::ADTType (enum_decl.get_mappings ().get_hirid (),
- mappings.get_next_hir_id (),
+ enum_decl.get_mappings ().get_hirid (),
enum_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::ENUM, std::move (variants),
std::move (substitutions));
@@ -440,7 +442,7 @@ TypeCheckItem::visit (HIR::Union &union_decl)
auto *type
= new TyTy::ADTType (union_decl.get_mappings ().get_hirid (),
- mappings.get_next_hir_id (),
+ union_decl.get_mappings ().get_hirid (),
union_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::UNION, std::move (variants),
std::move (substitutions));