Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gcc/rust/backend/rust-compile-intrinsic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Intrinsics::compile (TyTy::FnType *fntype)
return it->second (ctx, fntype);

location_t locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ());
rust_error_at (locus, ErrorCode ("E0093"),
rust_error_at (locus, ErrorCode::E0093,
"unrecognized intrinsic function: %<%s%>",
fntype->get_identifier ().c_str ());

Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/checks/errors/rust-feature-gate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ FeatureGate::gate (Feature::Name name, Location loc,
"<https://github.com/rust-lang/rust/issues/%u> for more "
"information. add `#![feature(%s)]` to the crate attributes to "
"enable.";
rust_error_at (loc, ErrorCode ("E0658"), fmt_str, error_msg.c_str (),
rust_error_at (loc, ErrorCode::E0658, fmt_str, error_msg.c_str (),
issue, issue, feature.as_string ().c_str ());
}
else
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/checks/errors/rust-unsafe-checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void
check_unsafe_call (HIR::Function *fn, location_t locus, const std::string &kind)
{
if (fn->get_qualifiers ().is_unsafe ())
rust_error_at (locus, ErrorCode ("E0133"),
rust_error_at (locus, ErrorCode::E0133,
"call to unsafe %s requires unsafe function or block",
kind.c_str ());
}
Expand Down
3 changes: 1 addition & 2 deletions gcc/rust/hir/rust-ast-lower-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,7 @@ struct_field_name_exists (std::vector<HIR::StructField> &fields,
{
rich_location r (line_table, new_field.get_locus ());
r.add_range (field.get_locus ());
rust_error_at (r, ErrorCode ("E0124"),
"field %qs is already declared",
rust_error_at (r, ErrorCode::E0124, "field %qs is already declared",
field.get_field_name ().as_string ().c_str ());
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-ast-resolve-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ResolveExpr::visit (AST::IdentifierExpr &expr)
}
else
{
rust_error_at (expr.get_locus (), ErrorCode ("E0425"),
rust_error_at (expr.get_locus (), ErrorCode::E0425,
"cannot find value %qs in this scope",
expr.as_string ().c_str ());
}
Expand Down
4 changes: 2 additions & 2 deletions gcc/rust/resolve/rust-ast-resolve-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ResolvePath::resolve_path (AST::PathInExpression *expr)
bool in_middle_of_path = i > 0;
if (in_middle_of_path && segment.is_lower_self_seg ())
{
rust_error_at (segment.get_locus (), ErrorCode ("E0433"),
rust_error_at (segment.get_locus (), ErrorCode::E0433,
"failed to resolve: %<%s%> in paths can only be used "
"in start position",
segment.as_string ().c_str ());
Expand Down Expand Up @@ -206,7 +206,7 @@ ResolvePath::resolve_path (AST::PathInExpression *expr)
}
else if (is_first_segment)
{
rust_error_at (segment.get_locus (), ErrorCode ("E0433"),
rust_error_at (segment.get_locus (), ErrorCode::E0433,
"Cannot find path %<%s%> in this scope",
segment.as_string ().c_str ());
return UNKNOWN_NODEID;
Expand Down
8 changes: 4 additions & 4 deletions gcc/rust/resolve/rust-ast-resolve-pattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PatternDeclaration::go (AST::Pattern *pattern, Rib::ItemType type,
auto ident = map_entry.first; // key
auto info = map_entry.second; // value

rust_error_at (info.get_locus (), ErrorCode ("E0408"),
rust_error_at (info.get_locus (), ErrorCode::E0408,
"variable '%s' is not bound in all patterns",
ident.as_string ().c_str ());
}
Expand All @@ -53,7 +53,7 @@ PatternDeclaration::go (AST::Pattern *pattern, Rib::ItemType type,
auto info = map_entry.second; // value

rust_error_at (
info.get_locus (), ErrorCode ("E0409"),
info.get_locus (), ErrorCode::E0409,
"variable '%s' is bound inconsistently across pattern alternatives",
ident.as_string ().c_str ());
}
Expand Down Expand Up @@ -278,15 +278,15 @@ PatternDeclaration::add_new_binding (Identifier ident, NodeId node_id,
{
if (type == Rib::ItemType::Param)
{
rust_error_at (info.get_locus (), ErrorCode ("E0415"),
rust_error_at (info.get_locus (), ErrorCode::E0415,
"identifier '%s' is bound more than once in the "
"same parameter list",
ident.as_string ().c_str ());
}
else
{
rust_error_at (
info.get_locus (), ErrorCode ("E0416"),
info.get_locus (), ErrorCode::E0416,
"identifier '%s' is bound more than once in the same pattern",
ident.as_string ().c_str ());
}
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-ast-resolve-type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ResolveRelativeTypePath::go (AST::TypePath &path, NodeId &resolved_node_id)
bool in_middle_of_path = i > 0;
if (in_middle_of_path && segment->is_lower_self_seg ())
{
rust_error_at (segment->get_locus (), ErrorCode ("E0433"),
rust_error_at (segment->get_locus (), ErrorCode::E0433,
"failed to resolve: %<%s%> in paths can only be used "
"in start position",
segment->as_string ().c_str ());
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-ast-verify-assignee.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class VerifyAsignee : public ResolverBase
VerifyAsignee checker;
assignee->accept_vis (checker);
if (!checker.ok)
rust_error_at (assignee->get_locus (), ErrorCode ("E0070"),
rust_error_at (assignee->get_locus (), ErrorCode::E0070,
"invalid left-hand side of assignment");
return checker.ok;
}
Expand Down
6 changes: 3 additions & 3 deletions gcc/rust/rust-diagnostics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ class rust_error_code_rule : public diagnostic_metadata::rule

char *make_description () const final override
{
return xstrdup (m_code.m_str);
return xstrdup (error_code_strings.at (m_code));
}

char *make_url () const final override
{
return concat ("https://doc.rust-lang.org/error-index.html#", m_code.m_str,
NULL);
return concat ("https://doc.rust-lang.org/error-index.html#",
error_code_strings.at (m_code), NULL);
}

private:
Expand Down
Loading