From 858e3af945e5a86d65a7d3776b4d51ca677967f9 Mon Sep 17 00:00:00 2001 From: Muhammad Mahad Date: Thu, 22 Jun 2023 13:04:12 +0500 Subject: [PATCH] gccrs: ErrorCode[E0277] Type Does Not Implement Expected Trait Type Does Not Implement Expected Trait - the type [{integer}] cannot be indexed by u32 gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): passed "E0277" * typecheck/rust-tyty.cc (BaseType::bounds_compatible): passed "E0277" Signed-off-by: Muhammad Mahad --- gcc/rust/typecheck/rust-hir-type-check-expr.cc | 3 ++- gcc/rust/typecheck/rust-tyty.cc | 2 +- 2 files changed, 3 insertions(+), 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 8bbbc224c8d3..734c4b49a5f2 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc @@ -867,7 +867,8 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr) RichLocation r (expr.get_locus ()); r.add_range (expr.get_array_expr ()->get_locus ()); r.add_range (expr.get_index_expr ()->get_locus ()); - rust_error_at (r, "the type %<%s%> cannot be indexed by %<%s%>", + rust_error_at (r, ErrorCode ("E0277"), + "the type %<%s%> cannot be indexed by %<%s%>", array_expr_ty->get_name ().c_str (), index_expr_ty->get_name ().c_str ()); } diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 143cab42ab52..06a8e7085364 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -396,7 +396,7 @@ BaseType::bounds_compatible (const BaseType &other, Location locus, if (emit_error) { - rust_error_at (r, + rust_error_at (r, ErrorCode ("E0277"), "bounds not satisfied for %s %<%s%> is not satisfied", other.get_name ().c_str (), missing_preds.c_str ()); // rust_assert (!emit_error); -- 2.47.2