-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 for appending `E` to the start. (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 (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 <[email protected]>
- Loading branch information
1 parent
27f5146
commit 5a74b6a
Showing
21 changed files
with
1,067 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.