]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: New Error Code Framework
authorMuhammad Mahad <mahadtxt@gmail.com>
Thu, 27 Jul 2023 16:36:55 +0000 (21:36 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:56:02 +0000 (18:56 +0100)
Updated ErrorCode struct to enum class to enforce proper
error codes, similiar to rustc. For converting the enum
to the respective error code, I used a map and updated
make_description & make_url function accordingly and
also removes the memory leak from the previous frame-
work. Also, added macro to safely convert the enum
number to string.

gcc/rust/ChangeLog:

* backend/rust-compile-intrinsic.cc (Intrinsics::compile):
Formatted according to enum class.
* checks/errors/rust-feature-gate.cc (FeatureGate::gate): likewise.
* checks/errors/rust-unsafe-checker.cc (check_unsafe_call): likewise.
* hir/rust-ast-lower-base.cc (struct_field_name_exists): likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path):
likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go): likewise.
(PatternDeclaration::add_new_binding): likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): likewise.
* resolve/rust-ast-verify-assignee.h: likewise.
* rust-diagnostics.cc: updated make_desc & url function for enum class.
* rust-diagnostics.h (struct ErrorCode): removed struct to switch to enum.
(enum class): Switched from errorcode struct to enum class.
(XSTR): Macro for converting enum to string.
(STR): macro Used by XSTR for converting to string.
(ERROR_CODE): macro used by map for check.
(TABLE_TO_MAP): macro used by map for check
* typecheck/rust-casts.cc (TypeCastRules::emit_cast_error):
Formatted according to enum class.
* typecheck/rust-hir-path-probe.h: likewise.
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise.
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit):
likewise.
(TypeCheckImplItemWithTrait::visit): likewise.
* typecheck/rust-hir-type-check-item.cc: likewise.
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): likewise.
(emit_invalid_field_error): likewise.
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve): likewise.
* typecheck/rust-tyty-call.cc (emit_unexpected_argument_error): likewise.
(TypeCheckCallExpr::visit): likewise.
* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
likewise.
* typecheck/rust-tyty.cc (BaseType::bounds_compatible): likewise.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
21 files changed:
gcc/rust/backend/rust-compile-intrinsic.cc
gcc/rust/checks/errors/rust-feature-gate.cc
gcc/rust/checks/errors/rust-unsafe-checker.cc
gcc/rust/hir/rust-ast-lower-base.cc
gcc/rust/resolve/rust-ast-resolve-expr.cc
gcc/rust/resolve/rust-ast-resolve-path.cc
gcc/rust/resolve/rust-ast-resolve-pattern.cc
gcc/rust/resolve/rust-ast-resolve-type.cc
gcc/rust/resolve/rust-ast-verify-assignee.h
gcc/rust/rust-diagnostics.cc
gcc/rust/rust-diagnostics.h
gcc/rust/typecheck/rust-casts.cc
gcc/rust/typecheck/rust-hir-path-probe.h
gcc/rust/typecheck/rust-hir-type-check-expr.cc
gcc/rust/typecheck/rust-hir-type-check-implitem.cc
gcc/rust/typecheck/rust-hir-type-check-item.cc
gcc/rust/typecheck/rust-hir-type-check-pattern.cc
gcc/rust/typecheck/rust-hir-type-check-struct.cc
gcc/rust/typecheck/rust-tyty-call.cc
gcc/rust/typecheck/rust-tyty-subst.cc
gcc/rust/typecheck/rust-tyty.cc

index 867318af1dafd608344851e5d5094b63168bacbd..b73c5433cd47c1e056223b8ddfe77b5297b9d6f8 100644 (file)
@@ -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 ());
 
index 187fec0dedb0e5397f49886d41d19aa5c256ca45..920b4128e027aab75fd57e8759e49ca646ec35af 100644 (file)
@@ -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
index 4ac9e59dff7c1eaaacdd9b830d5702741658fc5d..4d4b5e8615335330e505059ef102a46b799b6b76 100644 (file)
@@ -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 ());
 }
index f7601e4742beb5121f27bfddb98ea0ed92e23fd8..4ff49f997f3b120fee2b6306e7f2b7dfdb07091d 100644 (file)
@@ -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;
        }
index 7333cf4d5bc09e65f036f9231d9ebe497f95ab98..bb7c5ffa0efbede0838ca4af98e8ba64ec2b7282 100644 (file)
@@ -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 ());
     }
index ddbc544ce070c45303570042e03a2f6a574104ba..fd2a844a506adf2f111c6796067759e88be886f7 100644 (file)
@@ -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 ());
@@ -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;
index 03f86f6a712351b0fa4436c3a5c7e5f1797cecc6..934300532d8f9cd158841b709c29263e85497e3e 100644 (file)
@@ -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 ());
     }
@@ -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 ());
     }
@@ -278,7 +278,7 @@ 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 ());
@@ -286,7 +286,7 @@ PatternDeclaration::add_new_binding (Identifier ident, NodeId node_id,
       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 ());
        }
index 50681186556fd8199495dc3cd3210a01993e50d5..bf8cf8af090d50b785b7250c9031264e33d7de1d 100644 (file)
@@ -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 ());
index 9d801182d98fe2fbcc9c3526a276d656b11166dc..8f112c5f72cb4b78b6f2307016d733166247a6d0 100644 (file)
@@ -35,7 +35,7 @@ public:
     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;
   }
index 801bbf0e0547f6c60a3b12e48b3e78e1afb30485..cb813d453f965cb0b2f3776eaf38ae708a024a3e 100644 (file)
@@ -199,13 +199,13 @@ public:
 
   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:
index 30874ef8885ceeb4d94594e2a74befdfdc054f8b..4f00c7e2336e4c2e76b7063ed5429107731b7312 100644 (file)
 // clang-format off
 // simple location
 
-struct ErrorCode
-{
-  explicit ErrorCode (const char *str) : m_str (str)
-  {
-    gcc_assert (str);
-    gcc_assert (str[0] == 'E');
-  }
+// https://gist.github.com/MahadMuhammad/8c9d5fc88ea18d8c520937a8071d4185
+enum class ErrorCode 
+{ 
+  E0001, // this error code is no longer emitted by the compiler
+  E0002, // this error code is no longer emitted by the compiler
+  E0004,
+  E0005,
+  E0007, // this error code is no longer emitted by the compiler
+  E0009, // this error code is no longer emitted by the compiler
+  E0010,
+  E0013,
+  E0014, // this error code is no longer emitted by the compiler
+  E0015,
+  E0023,
+  E0025,
+  E0026,
+  E0027,
+  E0029,
+  E0030,
+  E0033,
+  E0034,
+  E0038,
+  E0040,
+  E0044,
+  E0045,
+  E0046,
+  E0049,
+  E0050,
+  E0053,
+  E0054,
+  E0055,
+  E0057,
+  E0059,
+  E0060,
+  E0061,
+  E0062,
+  E0063,
+  E0067,
+  E0069,
+  E0070,
+  E0071,
+  E0072,
+  E0073, // this error code is no longer emitted by the compiler
+  E0074, // this error code is no longer emitted by the compiler
+  E0075,
+  E0076,
+  E0077,
+  E0080,
+  E0081,
+  E0084,
+  E0087, // this error code is no longer emitted by the compiler
+  E0088, // this error code is no longer emitted by the compiler
+  E0089, // this error code is no longer emitted by the compiler
+  E0090, // this error code is no longer emitted by the compiler
+  E0091,
+  E0092,
+  E0093,
+  E0094,
+  E0106,
+  E0107,
+  E0109,
+  E0110, // this error code is no longer emitted by the compiler
+  E0116,
+  E0117,
+  E0118,
+  E0119,
+  E0120,
+  E0121,
+  E0124,
+  E0128,
+  E0130,
+  E0131,
+  E0132,
+  E0133,
+  E0136, // this error code is no longer emitted by the compiler
+  E0137, // this error code is no longer emitted by the compiler
+  E0138,
+  E0139, // this error code is no longer emitted by the compiler
+  E0152,
+  E0154, // this error code is no longer emitted by the compiler
+  E0158,
+  E0161,
+  E0162, // this error code is no longer emitted by the compiler
+  E0164,
+  E0165, // this error code is no longer emitted by the compiler
+  E0170,
+  E0178,
+  E0183,
+  E0184,
+  E0185,
+  E0186,
+  E0191,
+  E0192, // this error code is no longer emitted by the compiler
+  E0193, // this error code is no longer emitted by the compiler
+  E0195,
+  E0197,
+  E0198,
+  E0199,
+  E0200,
+  E0201,
+  E0203,
+  E0204,
+  E0205, // this error code is no longer emitted by the compiler
+  E0206,
+  E0207,
+  E0208, // this error code is no longer emitted by the compiler
+  E0210,
+  E0211, // this error code is no longer emitted by the compiler
+  E0212,
+  E0214,
+  E0220,
+  E0221,
+  E0222,
+  E0223,
+  E0224,
+  E0225,
+  E0226,
+  E0227,
+  E0228,
+  E0229,
+  E0230,
+  E0231,
+  E0232,
+  E0243, // this error code is no longer emitted by the compiler
+  E0244, // this error code is no longer emitted by the compiler
+  E0251, // this error code is no longer emitted by the compiler
+  E0252,
+  E0253,
+  E0254,
+  E0255,
+  E0256, // this error code is no longer emitted by the compiler
+  E0259,
+  E0260,
+  E0261,
+  E0262,
+  E0263, // this error code is no longer emitted by the compiler
+  E0264,
+  E0267,
+  E0268,
+  E0271,
+  E0275,
+  E0276,
+  E0277,
+  E0281, // this error code is no longer emitted by the compiler
+  E0282,
+  E0283,
+  E0284,
+  E0297, // this error code is no longer emitted by the compiler
+  E0301, // this error code is no longer emitted by the compiler
+  E0302, // this error code is no longer emitted by the compiler
+  E0303, // this error code is no longer emitted by the compiler
+  E0307,
+  E0308,
+  E0309,
+  E0310,
+  E0311,
+  E0312, // this error code is no longer emitted by the compiler
+  E0316,
+  E0317,
+  E0320,
+  E0321,
+  E0322,
+  E0323,
+  E0324,
+  E0325,
+  E0326,
+  E0328,
+  E0329, // this error code is no longer emitted by the compiler
+  E0364,
+  E0365,
+  E0366,
+  E0367,
+  E0368,
+  E0369,
+  E0370,
+  E0371,
+  E0373,
+  E0374,
+  E0375,
+  E0376,
+  E0377,
+  E0378,
+  E0379,
+  E0380,
+  E0381,
+  E0382,
+  E0383, // this error code is no longer emitted by the compiler
+  E0384,
+  E0386, // this error code is no longer emitted by the compiler
+  E0387, // this error code is no longer emitted by the compiler
+  E0388, // this error code is no longer emitted by the compiler
+  E0389, // this error code is no longer emitted by the compiler
+  E0390,
+  E0391,
+  E0392,
+  E0393,
+  E0398, // this error code is no longer emitted by the compiler
+  E0399,
+  E0401,
+  E0403,
+  E0404,
+  E0405,
+  E0407,
+  E0408,
+  E0409,
+  E0411,
+  E0412,
+  E0415,
+  E0416,
+  E0422,
+  E0423,
+  E0424,
+  E0425,
+  E0426,
+  E0428,
+  E0429,
+  E0430,
+  E0431,
+  E0432,
+  E0433,
+  E0434,
+  E0435,
+  E0436,
+  E0437,
+  E0438,
+  E0439, // this error code is no longer emitted by the compiler
+  E0445,
+  E0446,
+  E0447, // this error code is no longer emitted by the compiler
+  E0448, // this error code is no longer emitted by the compiler
+  E0449,
+  E0451,
+  E0452,
+  E0453,
+  E0454,
+  E0455,
+  E0457,
+  E0458,
+  E0459,
+  E0460,
+  E0461,
+  E0462,
+  E0463,
+  E0464,
+  E0466,
+  E0468,
+  E0469,
+  E0472,
+  E0476,
+  E0477, // this error code is no longer emitted by the compiler
+  E0478,
+  E0482, // this error code is no longer emitted by the compiler
+  E0491,
+  E0492,
+  E0493,
+  E0495, // this error code is no longer emitted by the compiler
+  E0496,
+  E0497, // this error code is no longer emitted by the compiler
+  E0498,
+  E0499,
+  E0500,
+  E0501,
+  E0502,
+  E0503,
+  E0504, // this error code is no longer emitted by the compiler
+  E0505,
+  E0506,
+  E0507,
+  E0508,
+  E0509,
+  E0510,
+  E0511,
+  E0512,
+  E0514,
+  E0515,
+  E0516,
+  E0517,
+  E0518,
+  E0519,
+  E0520,
+  E0521,
+  E0522,
+  E0523, // this error code is no longer emitted by the compiler
+  E0524,
+  E0525,
+  E0527,
+  E0528,
+  E0529,
+  E0530,
+  E0531,
+  E0532,
+  E0533,
+  E0534,
+  E0535,
+  E0536,
+  E0537,
+  E0538,
+  E0539,
+  E0541,
+  E0542,
+  E0543,
+  E0544,
+  E0545,
+  E0546,
+  E0547,
+  E0549,
+  E0550,
+  E0551,
+  E0552,
+  E0554,
+  E0556,
+  E0557,
+  E0559,
+  E0560,
+  E0561,
+  E0562,
+  E0565,
+  E0566,
+  E0567,
+  E0568,
+  E0569,
+  E0570,
+  E0571,
+  E0572,
+  E0573,
+  E0574,
+  E0575,
+  E0576,
+  E0577,
+  E0578,
+  E0579,
+  E0580,
+  E0581,
+  E0582,
+  E0583,
+  E0584,
+  E0585,
+  E0586,
+  E0587,
+  E0588,
+  E0589,
+  E0590,
+  E0591,
+  E0592,
+  E0593,
+  E0594,
+  E0595, // this error code is no longer emitted by the compiler
+  E0596,
+  E0597,
+  E0599,
+  E0600,
+  E0601,
+  E0602,
+  E0603,
+  E0604,
+  E0605,
+  E0606,
+  E0607,
+  E0608,
+  E0609,
+  E0610,
+  E0614,
+  E0615,
+  E0616,
+  E0617,
+  E0618,
+  E0619, // this error code is no longer emitted by the compiler
+  E0620,
+  E0621,
+  E0622,
+  E0623,
+  E0624,
+  E0625,
+  E0626,
+  E0627,
+  E0628,
+  E0631,
+  E0632, // this error code is no longer emitted by the compiler
+  E0633, // this error code is no longer emitted by the compiler
+  E0634,
+  E0635,
+  E0636,
+  E0637,
+  E0638,
+  E0639,
+  E0640,
+  E0641,
+  E0642,
+  E0643,
+  E0644,
+  E0646,
+  E0647,
+  E0648,
+  E0657,
+  E0658,
+  E0659,
+  E0660, // this error code is no longer emitted by the compiler
+  E0661, // this error code is no longer emitted by the compiler
+  E0662, // this error code is no longer emitted by the compiler
+  E0663, // this error code is no longer emitted by the compiler
+  E0664, // this error code is no longer emitted by the compiler
+  E0665, // this error code is no longer emitted by the compiler
+  E0666,
+  E0667,
+  E0668, // this error code is no longer emitted by the compiler
+  E0669, // this error code is no longer emitted by the compiler
+  E0670,
+  E0671, // this error code is no longer emitted by the compiler
+  E0687, // this error code is no longer emitted by the compiler
+  E0688, // this error code is no longer emitted by the compiler
+  E0689,
+  E0690,
+  E0691,
+  E0692,
+  E0693,
+  E0695,
+  E0696,
+  E0697,
+  E0698,
+  E0699,
+  E0700,
+  E0701,
+  E0703,
+  E0704,
+  E0705,
+  E0706,
+  E0708,
+  E0710,
+  E0711,
+  E0712,
+  E0713,
+  E0714,
+  E0715,
+  E0716,
+  E0717,
+  E0718,
+  E0719,
+  E0720,
+  E0722,
+  E0724,
+  E0725,
+  E0726,
+  E0727,
+  E0728,
+  E0729,
+  E0730,
+  E0731,
+  E0732,
+  E0733,
+  E0734,
+  E0735,
+  E0736,
+  E0737,
+  E0739,
+  E0740,
+  E0741,
+  E0742,
+  E0743,
+  E0744,
+  E0745,
+  E0746,
+  E0747,
+  E0748,
+  E0749,
+  E0750,
+  E0751,
+  E0752,
+  E0753,
+  E0754,
+  E0755,
+  E0756,
+  E0757,
+  E0758,
+  E0759, // this error code is no longer emitted by the compiler
+  E0760, // this error code is no longer emitted by the compiler
+  E0761,
+  E0762,
+  E0763,
+  E0764,
+  E0765,
+  E0766,
+  E0767,
+  E0768,
+  E0769,
+  E0770,
+  E0771,
+  E0772, // this error code is no longer emitted by the compiler
+  E0773,
+  E0774,
+  E0775,
+  E0776,
+  E0777,
+  E0778,
+  E0779,
+  E0780,
+  E0781,
+  E0782,
+  E0783,
+  E0784,
+  E0785,
+  E0786,
+  E0787,
+  E0788,
+  E0789,
+  E0790,
+  E0791,
+  E0792,
+  E0793,
+  E0794
+};
+
+// Custom hash function for ErrorCode, for older version of gcc
+namespace std {
+    template <>
+    struct hash<ErrorCode> {
+      size_t operator() (const ErrorCode &error) const
+      {
+        return hash<std::underlying_type<ErrorCode>::type> () (
+          static_cast<std::underlying_type<ErrorCode>::type> (error));
+      }
+    };
+}
+
+// see https://github.com/Rust-GCC/gccrs/pull/2468
+#define XSTR(A) STR(A)
+#define STR(A) #A
+#define ERROR_CODE(NUM) NUM
+#define TABLE_TO_MAP(NUM) { ErrorCode::ERROR_CODE(NUM), XSTR(ERROR_CODE(NUM)) } 
 
-  const char *m_str;
+static std::unordered_map<ErrorCode,const char *> error_code_strings = {
+TABLE_TO_MAP(E0001),
+TABLE_TO_MAP(E0002),
+TABLE_TO_MAP(E0004),
+TABLE_TO_MAP(E0005),
+TABLE_TO_MAP(E0007),
+TABLE_TO_MAP(E0009),
+TABLE_TO_MAP(E0010),
+TABLE_TO_MAP(E0013),
+TABLE_TO_MAP(E0014),
+TABLE_TO_MAP(E0015),
+TABLE_TO_MAP(E0023),
+TABLE_TO_MAP(E0025),
+TABLE_TO_MAP(E0026),
+TABLE_TO_MAP(E0027),
+TABLE_TO_MAP(E0029),
+TABLE_TO_MAP(E0030),
+TABLE_TO_MAP(E0033),
+TABLE_TO_MAP(E0034),
+TABLE_TO_MAP(E0038),
+TABLE_TO_MAP(E0040),
+TABLE_TO_MAP(E0044),
+TABLE_TO_MAP(E0045),
+TABLE_TO_MAP(E0046),
+TABLE_TO_MAP(E0049),
+TABLE_TO_MAP(E0050),
+TABLE_TO_MAP(E0053),
+TABLE_TO_MAP(E0054),
+TABLE_TO_MAP(E0055),
+TABLE_TO_MAP(E0057),
+TABLE_TO_MAP(E0059),
+TABLE_TO_MAP(E0060),
+TABLE_TO_MAP(E0061),
+TABLE_TO_MAP(E0062),
+TABLE_TO_MAP(E0063),
+TABLE_TO_MAP(E0067),
+TABLE_TO_MAP(E0069),
+TABLE_TO_MAP(E0070),
+TABLE_TO_MAP(E0071),
+TABLE_TO_MAP(E0072),
+TABLE_TO_MAP(E0073),
+TABLE_TO_MAP(E0074),
+TABLE_TO_MAP(E0075),
+TABLE_TO_MAP(E0076),
+TABLE_TO_MAP(E0077),
+TABLE_TO_MAP(E0080),
+TABLE_TO_MAP(E0081),
+TABLE_TO_MAP(E0084),
+TABLE_TO_MAP(E0087),
+TABLE_TO_MAP(E0088),
+TABLE_TO_MAP(E0089),
+TABLE_TO_MAP(E0090),
+TABLE_TO_MAP(E0091),
+TABLE_TO_MAP(E0092),
+TABLE_TO_MAP(E0093),
+TABLE_TO_MAP(E0094),
+TABLE_TO_MAP(E0106),
+TABLE_TO_MAP(E0107),
+TABLE_TO_MAP(E0109),
+TABLE_TO_MAP(E0110),
+TABLE_TO_MAP(E0116),
+TABLE_TO_MAP(E0117),
+TABLE_TO_MAP(E0118),
+TABLE_TO_MAP(E0119),
+TABLE_TO_MAP(E0120),
+TABLE_TO_MAP(E0121),
+TABLE_TO_MAP(E0124),
+TABLE_TO_MAP(E0128),
+TABLE_TO_MAP(E0130),
+TABLE_TO_MAP(E0131),
+TABLE_TO_MAP(E0132),
+TABLE_TO_MAP(E0133),
+TABLE_TO_MAP(E0136),
+TABLE_TO_MAP(E0137),
+TABLE_TO_MAP(E0138),
+TABLE_TO_MAP(E0139),
+TABLE_TO_MAP(E0152),
+TABLE_TO_MAP(E0154),
+TABLE_TO_MAP(E0158),
+TABLE_TO_MAP(E0161),
+TABLE_TO_MAP(E0162),
+TABLE_TO_MAP(E0164),
+TABLE_TO_MAP(E0165),
+TABLE_TO_MAP(E0170),
+TABLE_TO_MAP(E0178),
+TABLE_TO_MAP(E0183),
+TABLE_TO_MAP(E0184),
+TABLE_TO_MAP(E0185),
+TABLE_TO_MAP(E0186),
+TABLE_TO_MAP(E0191),
+TABLE_TO_MAP(E0192),
+TABLE_TO_MAP(E0193),
+TABLE_TO_MAP(E0195),
+TABLE_TO_MAP(E0197),
+TABLE_TO_MAP(E0198),
+TABLE_TO_MAP(E0199),
+TABLE_TO_MAP(E0200),
+TABLE_TO_MAP(E0201),
+TABLE_TO_MAP(E0203),
+TABLE_TO_MAP(E0204),
+TABLE_TO_MAP(E0205),
+TABLE_TO_MAP(E0206),
+TABLE_TO_MAP(E0207),
+TABLE_TO_MAP(E0208),
+TABLE_TO_MAP(E0210),
+TABLE_TO_MAP(E0211),
+TABLE_TO_MAP(E0212),
+TABLE_TO_MAP(E0214),
+TABLE_TO_MAP(E0220),
+TABLE_TO_MAP(E0221),
+TABLE_TO_MAP(E0222),
+TABLE_TO_MAP(E0223),
+TABLE_TO_MAP(E0224),
+TABLE_TO_MAP(E0225),
+TABLE_TO_MAP(E0226),
+TABLE_TO_MAP(E0227),
+TABLE_TO_MAP(E0228),
+TABLE_TO_MAP(E0229),
+TABLE_TO_MAP(E0230),
+TABLE_TO_MAP(E0231),
+TABLE_TO_MAP(E0232),
+TABLE_TO_MAP(E0243),
+TABLE_TO_MAP(E0244),
+TABLE_TO_MAP(E0251),
+TABLE_TO_MAP(E0252),
+TABLE_TO_MAP(E0253),
+TABLE_TO_MAP(E0254),
+TABLE_TO_MAP(E0255),
+TABLE_TO_MAP(E0256),
+TABLE_TO_MAP(E0259),
+TABLE_TO_MAP(E0260),
+TABLE_TO_MAP(E0261),
+TABLE_TO_MAP(E0262),
+TABLE_TO_MAP(E0263),
+TABLE_TO_MAP(E0264),
+TABLE_TO_MAP(E0267),
+TABLE_TO_MAP(E0268),
+TABLE_TO_MAP(E0271),
+TABLE_TO_MAP(E0275),
+TABLE_TO_MAP(E0276),
+TABLE_TO_MAP(E0277),
+TABLE_TO_MAP(E0281),
+TABLE_TO_MAP(E0282),
+TABLE_TO_MAP(E0283),
+TABLE_TO_MAP(E0284),
+TABLE_TO_MAP(E0297),
+TABLE_TO_MAP(E0301),
+TABLE_TO_MAP(E0302),
+TABLE_TO_MAP(E0303),
+TABLE_TO_MAP(E0307),
+TABLE_TO_MAP(E0308),
+TABLE_TO_MAP(E0309),
+TABLE_TO_MAP(E0310),
+TABLE_TO_MAP(E0311),
+TABLE_TO_MAP(E0312),
+TABLE_TO_MAP(E0316),
+TABLE_TO_MAP(E0317),
+TABLE_TO_MAP(E0320),
+TABLE_TO_MAP(E0321),
+TABLE_TO_MAP(E0322),
+TABLE_TO_MAP(E0323),
+TABLE_TO_MAP(E0324),
+TABLE_TO_MAP(E0325),
+TABLE_TO_MAP(E0326),
+TABLE_TO_MAP(E0328),
+TABLE_TO_MAP(E0329),
+TABLE_TO_MAP(E0364),
+TABLE_TO_MAP(E0365),
+TABLE_TO_MAP(E0366),
+TABLE_TO_MAP(E0367),
+TABLE_TO_MAP(E0368),
+TABLE_TO_MAP(E0369),
+TABLE_TO_MAP(E0370),
+TABLE_TO_MAP(E0371),
+TABLE_TO_MAP(E0373),
+TABLE_TO_MAP(E0374),
+TABLE_TO_MAP(E0375),
+TABLE_TO_MAP(E0376),
+TABLE_TO_MAP(E0377),
+TABLE_TO_MAP(E0378),
+TABLE_TO_MAP(E0379),
+TABLE_TO_MAP(E0380),
+TABLE_TO_MAP(E0381),
+TABLE_TO_MAP(E0382),
+TABLE_TO_MAP(E0383),
+TABLE_TO_MAP(E0384),
+TABLE_TO_MAP(E0386),
+TABLE_TO_MAP(E0387),
+TABLE_TO_MAP(E0388),
+TABLE_TO_MAP(E0389),
+TABLE_TO_MAP(E0390),
+TABLE_TO_MAP(E0391),
+TABLE_TO_MAP(E0392),
+TABLE_TO_MAP(E0393),
+TABLE_TO_MAP(E0398),
+TABLE_TO_MAP(E0399),
+TABLE_TO_MAP(E0401),
+TABLE_TO_MAP(E0403),
+TABLE_TO_MAP(E0404),
+TABLE_TO_MAP(E0405),
+TABLE_TO_MAP(E0407),
+TABLE_TO_MAP(E0408),
+TABLE_TO_MAP(E0409),
+TABLE_TO_MAP(E0411),
+TABLE_TO_MAP(E0412),
+TABLE_TO_MAP(E0415),
+TABLE_TO_MAP(E0416),
+TABLE_TO_MAP(E0422),
+TABLE_TO_MAP(E0423),
+TABLE_TO_MAP(E0424),
+TABLE_TO_MAP(E0425),
+TABLE_TO_MAP(E0426),
+TABLE_TO_MAP(E0428),
+TABLE_TO_MAP(E0429),
+TABLE_TO_MAP(E0430),
+TABLE_TO_MAP(E0431),
+TABLE_TO_MAP(E0432),
+TABLE_TO_MAP(E0433),
+TABLE_TO_MAP(E0434),
+TABLE_TO_MAP(E0435),
+TABLE_TO_MAP(E0436),
+TABLE_TO_MAP(E0437),
+TABLE_TO_MAP(E0438),
+TABLE_TO_MAP(E0439),
+TABLE_TO_MAP(E0445),
+TABLE_TO_MAP(E0446),
+TABLE_TO_MAP(E0447),
+TABLE_TO_MAP(E0448),
+TABLE_TO_MAP(E0449),
+TABLE_TO_MAP(E0451),
+TABLE_TO_MAP(E0452),
+TABLE_TO_MAP(E0453),
+TABLE_TO_MAP(E0454),
+TABLE_TO_MAP(E0455),
+TABLE_TO_MAP(E0457),
+TABLE_TO_MAP(E0458),
+TABLE_TO_MAP(E0459),
+TABLE_TO_MAP(E0460),
+TABLE_TO_MAP(E0461),
+TABLE_TO_MAP(E0462),
+TABLE_TO_MAP(E0463),
+TABLE_TO_MAP(E0464),
+TABLE_TO_MAP(E0466),
+TABLE_TO_MAP(E0468),
+TABLE_TO_MAP(E0469),
+TABLE_TO_MAP(E0472),
+TABLE_TO_MAP(E0476),
+TABLE_TO_MAP(E0477),
+TABLE_TO_MAP(E0478),
+TABLE_TO_MAP(E0482),
+TABLE_TO_MAP(E0491),
+TABLE_TO_MAP(E0492),
+TABLE_TO_MAP(E0493),
+TABLE_TO_MAP(E0495),
+TABLE_TO_MAP(E0496),
+TABLE_TO_MAP(E0497),
+TABLE_TO_MAP(E0498),
+TABLE_TO_MAP(E0499),
+TABLE_TO_MAP(E0500),
+TABLE_TO_MAP(E0501),
+TABLE_TO_MAP(E0502),
+TABLE_TO_MAP(E0503),
+TABLE_TO_MAP(E0504),
+TABLE_TO_MAP(E0505),
+TABLE_TO_MAP(E0506),
+TABLE_TO_MAP(E0507),
+TABLE_TO_MAP(E0508),
+TABLE_TO_MAP(E0509),
+TABLE_TO_MAP(E0510),
+TABLE_TO_MAP(E0511),
+TABLE_TO_MAP(E0512),
+TABLE_TO_MAP(E0514),
+TABLE_TO_MAP(E0515),
+TABLE_TO_MAP(E0516),
+TABLE_TO_MAP(E0517),
+TABLE_TO_MAP(E0518),
+TABLE_TO_MAP(E0519),
+TABLE_TO_MAP(E0520),
+TABLE_TO_MAP(E0521),
+TABLE_TO_MAP(E0522),
+TABLE_TO_MAP(E0523),
+TABLE_TO_MAP(E0524),
+TABLE_TO_MAP(E0525),
+TABLE_TO_MAP(E0527),
+TABLE_TO_MAP(E0528),
+TABLE_TO_MAP(E0529),
+TABLE_TO_MAP(E0530),
+TABLE_TO_MAP(E0531),
+TABLE_TO_MAP(E0532),
+TABLE_TO_MAP(E0533),
+TABLE_TO_MAP(E0534),
+TABLE_TO_MAP(E0535),
+TABLE_TO_MAP(E0536),
+TABLE_TO_MAP(E0537),
+TABLE_TO_MAP(E0538),
+TABLE_TO_MAP(E0539),
+TABLE_TO_MAP(E0541),
+TABLE_TO_MAP(E0542),
+TABLE_TO_MAP(E0543),
+TABLE_TO_MAP(E0544),
+TABLE_TO_MAP(E0545),
+TABLE_TO_MAP(E0546),
+TABLE_TO_MAP(E0547),
+TABLE_TO_MAP(E0549),
+TABLE_TO_MAP(E0550),
+TABLE_TO_MAP(E0551),
+TABLE_TO_MAP(E0552),
+TABLE_TO_MAP(E0554),
+TABLE_TO_MAP(E0556),
+TABLE_TO_MAP(E0557),
+TABLE_TO_MAP(E0559),
+TABLE_TO_MAP(E0560),
+TABLE_TO_MAP(E0561),
+TABLE_TO_MAP(E0562),
+TABLE_TO_MAP(E0565),
+TABLE_TO_MAP(E0566),
+TABLE_TO_MAP(E0567),
+TABLE_TO_MAP(E0568),
+TABLE_TO_MAP(E0569),
+TABLE_TO_MAP(E0570),
+TABLE_TO_MAP(E0571),
+TABLE_TO_MAP(E0572),
+TABLE_TO_MAP(E0573),
+TABLE_TO_MAP(E0574),
+TABLE_TO_MAP(E0575),
+TABLE_TO_MAP(E0576),
+TABLE_TO_MAP(E0577),
+TABLE_TO_MAP(E0578),
+TABLE_TO_MAP(E0579),
+TABLE_TO_MAP(E0580),
+TABLE_TO_MAP(E0581),
+TABLE_TO_MAP(E0582),
+TABLE_TO_MAP(E0583),
+TABLE_TO_MAP(E0584),
+TABLE_TO_MAP(E0585),
+TABLE_TO_MAP(E0586),
+TABLE_TO_MAP(E0587),
+TABLE_TO_MAP(E0588),
+TABLE_TO_MAP(E0589),
+TABLE_TO_MAP(E0590),
+TABLE_TO_MAP(E0591),
+TABLE_TO_MAP(E0592),
+TABLE_TO_MAP(E0593),
+TABLE_TO_MAP(E0594),
+TABLE_TO_MAP(E0595),
+TABLE_TO_MAP(E0596),
+TABLE_TO_MAP(E0597),
+TABLE_TO_MAP(E0599),
+TABLE_TO_MAP(E0600),
+TABLE_TO_MAP(E0601),
+TABLE_TO_MAP(E0602),
+TABLE_TO_MAP(E0603),
+TABLE_TO_MAP(E0604),
+TABLE_TO_MAP(E0605),
+TABLE_TO_MAP(E0606),
+TABLE_TO_MAP(E0607),
+TABLE_TO_MAP(E0608),
+TABLE_TO_MAP(E0609),
+TABLE_TO_MAP(E0610),
+TABLE_TO_MAP(E0614),
+TABLE_TO_MAP(E0615),
+TABLE_TO_MAP(E0616),
+TABLE_TO_MAP(E0617),
+TABLE_TO_MAP(E0618),
+TABLE_TO_MAP(E0619),
+TABLE_TO_MAP(E0620),
+TABLE_TO_MAP(E0621),
+TABLE_TO_MAP(E0622),
+TABLE_TO_MAP(E0623),
+TABLE_TO_MAP(E0624),
+TABLE_TO_MAP(E0625),
+TABLE_TO_MAP(E0626),
+TABLE_TO_MAP(E0627),
+TABLE_TO_MAP(E0628),
+TABLE_TO_MAP(E0631),
+TABLE_TO_MAP(E0632),
+TABLE_TO_MAP(E0633),
+TABLE_TO_MAP(E0634),
+TABLE_TO_MAP(E0635),
+TABLE_TO_MAP(E0636),
+TABLE_TO_MAP(E0637),
+TABLE_TO_MAP(E0638),
+TABLE_TO_MAP(E0639),
+TABLE_TO_MAP(E0640),
+TABLE_TO_MAP(E0641),
+TABLE_TO_MAP(E0642),
+TABLE_TO_MAP(E0643),
+TABLE_TO_MAP(E0644),
+TABLE_TO_MAP(E0646),
+TABLE_TO_MAP(E0647),
+TABLE_TO_MAP(E0648),
+TABLE_TO_MAP(E0657),
+TABLE_TO_MAP(E0658),
+TABLE_TO_MAP(E0659),
+TABLE_TO_MAP(E0660),
+TABLE_TO_MAP(E0661),
+TABLE_TO_MAP(E0662),
+TABLE_TO_MAP(E0663),
+TABLE_TO_MAP(E0664),
+TABLE_TO_MAP(E0665),
+TABLE_TO_MAP(E0666),
+TABLE_TO_MAP(E0667),
+TABLE_TO_MAP(E0668),
+TABLE_TO_MAP(E0669),
+TABLE_TO_MAP(E0670),
+TABLE_TO_MAP(E0671),
+TABLE_TO_MAP(E0687),
+TABLE_TO_MAP(E0688),
+TABLE_TO_MAP(E0689),
+TABLE_TO_MAP(E0690),
+TABLE_TO_MAP(E0691),
+TABLE_TO_MAP(E0692),
+TABLE_TO_MAP(E0693),
+TABLE_TO_MAP(E0695),
+TABLE_TO_MAP(E0696),
+TABLE_TO_MAP(E0697),
+TABLE_TO_MAP(E0698),
+TABLE_TO_MAP(E0699),
+TABLE_TO_MAP(E0700),
+TABLE_TO_MAP(E0701),
+TABLE_TO_MAP(E0703),
+TABLE_TO_MAP(E0704),
+TABLE_TO_MAP(E0705),
+TABLE_TO_MAP(E0706),
+TABLE_TO_MAP(E0708),
+TABLE_TO_MAP(E0710),
+TABLE_TO_MAP(E0711),
+TABLE_TO_MAP(E0712),
+TABLE_TO_MAP(E0713),
+TABLE_TO_MAP(E0714),
+TABLE_TO_MAP(E0715),
+TABLE_TO_MAP(E0716),
+TABLE_TO_MAP(E0717),
+TABLE_TO_MAP(E0718),
+TABLE_TO_MAP(E0719),
+TABLE_TO_MAP(E0720),
+TABLE_TO_MAP(E0722),
+TABLE_TO_MAP(E0724),
+TABLE_TO_MAP(E0725),
+TABLE_TO_MAP(E0726),
+TABLE_TO_MAP(E0727),
+TABLE_TO_MAP(E0728),
+TABLE_TO_MAP(E0729),
+TABLE_TO_MAP(E0730),
+TABLE_TO_MAP(E0731),
+TABLE_TO_MAP(E0732),
+TABLE_TO_MAP(E0733),
+TABLE_TO_MAP(E0734),
+TABLE_TO_MAP(E0735),
+TABLE_TO_MAP(E0736),
+TABLE_TO_MAP(E0737),
+TABLE_TO_MAP(E0739),
+TABLE_TO_MAP(E0740),
+TABLE_TO_MAP(E0741),
+TABLE_TO_MAP(E0742),
+TABLE_TO_MAP(E0743),
+TABLE_TO_MAP(E0744),
+TABLE_TO_MAP(E0745),
+TABLE_TO_MAP(E0746),
+TABLE_TO_MAP(E0747),
+TABLE_TO_MAP(E0748),
+TABLE_TO_MAP(E0749),
+TABLE_TO_MAP(E0750),
+TABLE_TO_MAP(E0751),
+TABLE_TO_MAP(E0752),
+TABLE_TO_MAP(E0753),
+TABLE_TO_MAP(E0754),
+TABLE_TO_MAP(E0755),
+TABLE_TO_MAP(E0756),
+TABLE_TO_MAP(E0757),
+TABLE_TO_MAP(E0758),
+TABLE_TO_MAP(E0759),
+TABLE_TO_MAP(E0760),
+TABLE_TO_MAP(E0761),
+TABLE_TO_MAP(E0762),
+TABLE_TO_MAP(E0763),
+TABLE_TO_MAP(E0764),
+TABLE_TO_MAP(E0765),
+TABLE_TO_MAP(E0766),
+TABLE_TO_MAP(E0767),
+TABLE_TO_MAP(E0768),
+TABLE_TO_MAP(E0769),
+TABLE_TO_MAP(E0770),
+TABLE_TO_MAP(E0771),
+TABLE_TO_MAP(E0772),
+TABLE_TO_MAP(E0773),
+TABLE_TO_MAP(E0774),
+TABLE_TO_MAP(E0775),
+TABLE_TO_MAP(E0776),
+TABLE_TO_MAP(E0777),
+TABLE_TO_MAP(E0778),
+TABLE_TO_MAP(E0779),
+TABLE_TO_MAP(E0780),
+TABLE_TO_MAP(E0781),
+TABLE_TO_MAP(E0782),
+TABLE_TO_MAP(E0783),
+TABLE_TO_MAP(E0784),
+TABLE_TO_MAP(E0785),
+TABLE_TO_MAP(E0786),
+TABLE_TO_MAP(E0787),
+TABLE_TO_MAP(E0788),
+TABLE_TO_MAP(E0789),
+TABLE_TO_MAP(E0790),
+TABLE_TO_MAP(E0791),
+TABLE_TO_MAP(E0792),
+TABLE_TO_MAP(E0793),
+TABLE_TO_MAP(E0794),
 };
 
 extern void
index 640d14792e4d83fd6c2a9e564e78999c67312340..9300e7a7f71b082b4acc4f37ca97c821afa768d1 100644 (file)
@@ -304,7 +304,7 @@ TypeCastRules::emit_cast_error () const
   rich_location r (line_table, locus);
   r.add_range (from.get_locus ());
   r.add_range (to.get_locus ());
-  rust_error_at (r, ErrorCode ("E0054"), "invalid cast %<%s%> to %<%s%>",
+  rust_error_at (r, ErrorCode::E0054, "invalid cast %<%s%> to %<%s%>",
                 from.get_ty ()->get_name ().c_str (),
                 to.get_ty ()->get_name ().c_str ());
 }
index ea041acb4b2ed1798016c1a8cc0bdd2a3d6263b8..e70372bf1014c83121a6b4717553d74d452b3131 100644 (file)
@@ -164,7 +164,7 @@ public:
     for (auto &c : candidates)
       r.add_range (c.locus);
 
-    rust_error_at (r, ErrorCode ("E0034"),
+    rust_error_at (r, ErrorCode::E0034,
                   "multiple applicable items in scope for: %s",
                   query.as_string ().c_str ());
   }
index a1da9db678262dc3f2fdb2bb5e4083721d0a34ea..95812d0a14edf3c1b6fb31c2619c9424c31fcf4a 100644 (file)
@@ -870,7 +870,7 @@ TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
   rich_location r (line_table, 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, ErrorCode ("E0277"),
+  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 ());
@@ -1277,7 +1277,7 @@ TypeCheckExpr::visit (HIR::BreakExpr &expr)
 {
   if (!context->have_loop_context ())
     {
-      rust_error_at (expr.get_locus (), ErrorCode ("E0268"),
+      rust_error_at (expr.get_locus (), ErrorCode::E0268,
                     "%<break%> outside of a loop or labeled block");
       return;
     }
@@ -1312,7 +1312,7 @@ TypeCheckExpr::visit (HIR::ContinueExpr &expr)
 {
   if (!context->have_loop_context ())
     {
-      rust_error_at (expr.get_locus (), ErrorCode ("E0268"),
+      rust_error_at (expr.get_locus (), ErrorCode::E0268,
                     "%<continue%> outside of a loop");
       return;
     }
index 92868b9e343aee63d3d4f946f832341844424349..f63f2d1542064451c6a337c597e4f5e1a41b7354 100644 (file)
@@ -143,7 +143,7 @@ TypeCheckTopLevelExternItem::visit (HIR::ExternalFunctionItem &function)
       if (parent.get_abi () != Rust::ABI::C)
        {
          rust_error_at (
-           function.get_locus (), ErrorCode ("E0045"),
+           function.get_locus (), ErrorCode::E0045,
            "C-variadic function must have C or cdecl calling convention");
        }
     }
@@ -402,7 +402,7 @@ TypeCheckImplItemWithTrait::visit (HIR::ConstantItem &constant)
     {
       rich_location r (line_table, constant.get_locus ());
       r.add_range (trait_reference.get_locus ());
-      rust_error_at (r, ErrorCode ("E0323"),
+      rust_error_at (r, ErrorCode::E0323,
                     "item %qs is an associated const, which does not match "
                     "its trait %qs",
                     constant.get_identifier ().as_string ().c_str (),
@@ -539,7 +539,7 @@ TypeCheckImplItemWithTrait::visit (HIR::Function &function)
       rich_location r (line_table, function.get_locus ());
       r.add_range (resolved_trait_item.get_locus ());
 
-      rust_error_at (r, ErrorCode ("E0053"),
+      rust_error_at (r, ErrorCode::E0053,
                     "method %<%s%> has an incompatible type for trait %<%s%>",
                     function.get_function_name ().as_string ().c_str (),
                     trait_reference.get_name ().c_str ());
index 4e50d6817ba291157fd98b62bd5d6655d9f1b5dc..e8a4f97ed2595d31811e10585371bd42ffc405c1 100644 (file)
@@ -659,7 +659,7 @@ TypeCheckItem::validate_trait_impl_block (
              r.add_range (missing_trait_item.get_locus ());
            }
 
-         rust_error_at (r, ErrorCode ("E0046"),
+         rust_error_at (r, ErrorCode::E0046,
                         "missing %s in implementation of trait %<%s%>",
                         missing_items_buf.c_str (),
                         trait_reference->get_name ().c_str ());
index 028becfad95b2a3a4d85de9e54df8ab07b60edaf..67af3c6364715fe970bce1395956b8fc0219f421 100644 (file)
@@ -112,7 +112,7 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
        if (items_no_range.get_patterns ().size () != variant->num_fields ())
          {
            rust_error_at (
-             pattern.get_locus (), ErrorCode ("E0023"),
+             pattern.get_locus (), ErrorCode::E0023,
              "this pattern has %lu fields but the corresponding "
              "tuple variant has %lu field",
              (unsigned long) items_no_range.get_patterns ().size (),
@@ -143,7 +143,7 @@ void
 emit_invalid_field_error (Location loc, Rust::TyTy::VariantDef *variant,
                          const std::string &name)
 {
-  rust_error_at (loc, ErrorCode ("E0026"),
+  rust_error_at (loc, ErrorCode::E0026,
                 "variant %s does not have a field named %s",
                 variant->get_identifier ().c_str (), name.c_str ());
 }
@@ -268,7 +268,7 @@ TypeCheckPattern::visit (HIR::StructPattern &pattern)
          i++;
        }
 
-      rust_error_at (pattern.get_locus (), ErrorCode ("E0027"),
+      rust_error_at (pattern.get_locus (), ErrorCode::E0027,
                     "pattern does not mention fields %s",
                     missing_fields_str.c_str ());
     }
index 08488093fdd2005e6a721a7456df7edb2b7f638a..5688aafe7b4abebc8dcd8d181ff24720f2181362 100644 (file)
@@ -149,7 +149,7 @@ TypeCheckStructExpr::resolve (HIR::StructExprStructFields &struct_expr)
        }
       else if (!struct_expr.has_struct_base ())
        {
-         rust_error_at (struct_expr.get_locus (), ErrorCode ("E0063"),
+         rust_error_at (struct_expr.get_locus (), ErrorCode::E0063,
                         "constructor is missing fields");
          return;
        }
index 733ba616a868f9cb03357643a49b5e95e8aa2f1a..f2e5e85e4846986ac4746c2e18e206b7ab1d0dd1 100644 (file)
@@ -48,7 +48,7 @@ emit_unexpected_argument_error (Location loc,
     {
       err_msg += " but %lu arguments were supplied";
     }
-  rust_error_at (loc, ErrorCode ("E0061"), err_msg.c_str (), expected_arg_count,
+  rust_error_at (loc, ErrorCode::E0061, err_msg.c_str (), expected_arg_count,
                 unexpected_arg_count);
 }
 
@@ -59,7 +59,7 @@ TypeCheckCallExpr::visit (ADTType &type)
   if (variant.get_variant_type () != TyTy::VariantDef::VariantType::TUPLE)
     {
       rust_error_at (
-       call.get_locus (), ErrorCode ("E0423"),
+       call.get_locus (), ErrorCode::E0423,
        "expected function, tuple struct or tuple variant, found struct %<%s%>",
        type.get_name ().c_str ());
       return;
index aea96857bb3c634f5243b678dc3443d95cacf0f3..ba23eafee6f9b1559b22212e26c1feba42e8c932 100644 (file)
@@ -606,7 +606,7 @@ SubstitutionRef::get_mappings_from_generic_args (HIR::GenericArgs &args)
          for (auto &binding : args.get_binding_args ())
            r.add_range (binding.get_locus ());
 
-         rust_error_at (r, ErrorCode ("E0229"),
+         rust_error_at (r, ErrorCode::E0229,
                         "associated type bindings are not allowed here");
          return SubstitutionArgumentMappings::error ();
        }
index f07c6d22712cccf47d7b52250c1ebe60528f9864..a4cb8f2da942042f3325afd8367940e750c0f0c8 100644 (file)
@@ -397,7 +397,7 @@ BaseType::bounds_compatible (const BaseType &other, location_t locus,
 
       if (emit_error)
        {
-         rust_error_at (r, ErrorCode ("E0277"),
+         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);