Skip to content

Commit

Permalink
ErrorCode[E0277] Type Does Not Implement Expected Trait
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
MahadMuhammad authored and philberty committed Jun 25, 2023
1 parent 210557d commit 04eb580
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gcc/rust/typecheck/rust-hir-type-check-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
}
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/typecheck/rust-tyty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 04eb580

Please sign in to comment.