public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] hir: Fix ReferencePattern typechecking
@ 2023-03-14 11:44 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-03-14 11:44 UTC (permalink / raw)
  To: gcc-cvs

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-14 11:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 11:44 [gcc/devel/rust/master] hir: Fix ReferencePattern typechecking Thomas Schwinge

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).