public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] hir: Fix ReferencePattern typechecking
Date: Tue, 14 Mar 2023 11:44:19 +0000 (GMT) [thread overview]
Message-ID: <20230314114420.009C93858C33@sourceware.org> (raw)
https://gcc.gnu.org/g:f31fc7b0f6fb22e84a27dc68f69cb0fca9707879
commit f31fc7b0f6fb22e84a27dc68f69cb0fca9707879
Author: Mahmoud Mohamed <mahadelr19@gmail.com>
Date: Mon Mar 13 02:26:13 2023 +0300
hir: Fix ReferencePattern typechecking
The visit for TypeCheckPattern::visit (HIR::ReferencePattern) was missing
an assignment to infered
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit):
Add the missing infered type assignment
Signed-off-by: Mahmoud Mohamed <mahadelr19@gmail.com>
Diff:
---
gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index cd0dbef40fe..228d2dd2443 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -355,8 +355,14 @@ TypeCheckPattern::visit (HIR::ReferencePattern &pattern)
parent->as_string ().c_str ());
TyTy::ReferenceType *ref_ty_ty = static_cast<TyTy::ReferenceType *> (parent);
- TypeCheckPattern::Resolve (pattern.get_referenced_pattern ().get (),
- ref_ty_ty->get_base ());
+ TyTy::BaseType *infered_base
+ = TypeCheckPattern::Resolve (pattern.get_referenced_pattern ().get (),
+ ref_ty_ty->get_base ());
+ infered
+ = new TyTy::ReferenceType (pattern.get_pattern_mappings ().get_hirid (),
+ TyTy::TyVar (infered_base->get_ref ()),
+ pattern.is_mut () ? Mutability::Mut
+ : Mutability::Imm);
}
void
reply other threads:[~2023-03-14 11:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230314114420.009C93858C33@sourceware.org \
--to=tschwinge@gcc.gnu.org \
--cc=gcc-cvs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).