public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Reuse index_expr_ty type instead of type checking the index expression twice
@ 2022-06-08 12:49 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a369360b922a586d9eb532490fb54edfe0019400

commit a369360b922a586d9eb532490fb54edfe0019400
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Tue May 24 16:19:42 2022 +0100

    Reuse index_expr_ty type instead of type checking the index expression twice

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-expr.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index c499204a40c..394eee07b5e 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -291,8 +291,7 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
   bool ok = context->lookup_builtin ("usize", &size_ty);
   rust_assert (ok);
 
-  auto resolved_index_expr
-    = size_ty->unify (TypeCheckExpr::Resolve (expr.get_index_expr (), false));
+  auto resolved_index_expr = size_ty->unify (index_expr_ty);
   if (resolved_index_expr->get_kind () == TyTy::TypeKind::ERROR)
     return;


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

only message in thread, other threads:[~2022-06-08 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:49 [gcc/devel/rust/master] Reuse index_expr_ty type instead of type checking the index expression twice 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).