diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-02-12 18:20:19 -0500 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-02-21 13:51:26 +0100 |
commit | cdd76382414191134e0dabcc2c9f66f1df5472e7 (patch) | |
tree | 51c6fdc816fd769fbb966ee5f3c5434a2d403c05 /gcc/rust | |
parent | d7dde4ba49da7947d800fd7ab8e5a0e747073ead (diff) |
gccrs: Fix lookup of TuplePattern sub-pattern types
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit):
Lookup type of sub-pattern, not tuple pattern itself.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2847-b.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/backend/rust-compile-pattern.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc index 4fa611f5383..1a32f02c3ea 100644 --- a/gcc/rust/backend/rust-compile-pattern.cc +++ b/gcc/rust/backend/rust-compile-pattern.cc @@ -678,8 +678,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern) for (auto &sub : items_lower) { TyTy::BaseType *ty_sub = nullptr; - HirId pattern_id = pattern.get_mappings ().get_hirid (); - bool ok = ctx->get_tyctx ()->lookup_type (pattern_id, &ty_sub); + HirId sub_id = sub->get_mappings ().get_hirid (); + bool ok = ctx->get_tyctx ()->lookup_type (sub_id, &ty_sub); rust_assert (ok); tree sub_init @@ -697,8 +697,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern) for (auto &sub : items_upper) { TyTy::BaseType *ty_sub = nullptr; - HirId pattern_id = pattern.get_mappings ().get_hirid (); - bool ok = ctx->get_tyctx ()->lookup_type (pattern_id, &ty_sub); + HirId sub_id = sub->get_mappings ().get_hirid (); + bool ok = ctx->get_tyctx ()->lookup_type (sub_id, &ty_sub); rust_assert (ok); tree sub_init @@ -719,8 +719,8 @@ CompilePatternLet::visit (HIR::TuplePattern &pattern) for (auto &sub : items.get_patterns ()) { TyTy::BaseType *ty_sub = nullptr; - HirId pattern_id = pattern.get_mappings ().get_hirid (); - bool ok = ctx->get_tyctx ()->lookup_type (pattern_id, &ty_sub); + HirId sub_id = sub->get_mappings ().get_hirid (); + bool ok = ctx->get_tyctx ()->lookup_type (sub_id, &ty_sub); rust_assert (ok); tree sub_init |