# Final Report
# Final Report Page
---

## Enhancing user errors & Error Code Support for GCC Rust (GCCRS) Frontend
- Organization: [GNU Compiler Collection (GCC)](https://gcc.gnu.org/)
- Mentors: [Philip Herron](https://github.com/philberty/), [Arthur Cohen](https://github.com/cohenarthur/)
---
## Description:
The goal of this project is to enhance the user experience of gnu gccrs by introducing and implementing error codes that are compatible with rustc. This will facilitate the integration of the two test suites and enable the rustc testsuite to run on gccrs. The project will require modifying the gccrs frontend code to generate more informative error messages and rich locations to assist users and developers in improving their code.
---
## What was done:
- [x] Restructured the `ErrorCode` struct into an `enum` class, alongside the respective functions like `make_description` and `make_url`. This modification was carried out to enforce accurate error codes and establish an API for emitting error codes.
- [x] Updated & refactored the error handling code to use the new error code framework.
- [x]Addressed a prevailing memory leak that was present in the previous error code framework.
- [x] Enhanced the Error struct's functionality to encompass storage of error codes and locations. This was used as a wrapper function to store and emit error codes specifically tailored for parsing and expansion errors.
- [x] Modified error handling code to use `rich locations`, which offer more details about the error location and help users and developers to improve their code.
- [x] Refined error messages to be more user-friendly and informative.
- [x] Conducted a comprehensive comparison between the rustc test suite and gccrs, resulting in the identification and rectification of several issues, including bugs and internal compiler errors. This iterative process led to substantial improvements in the gccrs stability. The detailed analysis is available on dedicated [comparison page](https://mahadmuhammad.github.io/gsoc/23/r/relative-to-rustc/).
---
## Previous & Current state:
In a prior development phase, [David Malcolm](https://github.com/davidmalcolm) extended the capabilities of GCC diagnostics to incorporate support for associating diagnostics with rules from coding standards. We are using this feature to associate gcc-rust error codes. The initial introduction included a solitary error, denoted as [E0054](https://doc.rust-lang.org/error_codes/E0054.html) , addressing non-allowed cast operations to bool. Following the integration of further type-checking mechanisms, gccrs commenced emitting error codes and messages that closely resembled those of rustc.
```rust
fn main() {
let x = 5;
let x_is_nonzero = x as bool;
0u32 as char;
let x = &[1_usize, 2] as [usize];
let a = &0u8;
let y: u32 = a as u32;
}
```
### Previous State:
The previous version exhibited the following output:
```bash
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:3:24: error: invalid cast ‘<integer>’ to ‘bool’ [E0054]
3 | let x_is_nonzero = x as bool;
| ^ ~~~~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:5:5: error:invalid cast ‘u32’ to ‘char’ [E0054]
5 | 0u32 as char;
| ^~~~ ~~~~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:7:13: error: invalid cast ‘& [usize:CAPACITY]’ to ‘[usize]’ [E0054]
7 | let x = &[1_usize, 2] as [usize];
| ^ ~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:10:18: error: invalid cast ‘& u8’ to ‘u32’ [E0054]
10 | let y: u32 = a as u32;
| ^ ~~~
```
### Current State:
With the incorporation of the latest type checking code, the system now emits more specific error codes and associated error messages.
```bash
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:3:24: error: cannot cast ‘<integer>’ as ‘bool’ [E0054]
3 | let x_is_nonzero = x as bool;
| ^ ~~~~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:5:5: error: cannot cast ‘u32’ as ‘char’, only ‘u8’ can be cast as ‘char’ [E0604]
5 | 0u32 as char;
| ^~~~ ~~~~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:7:13: error: cast to unsized type: ‘& [usize:CAPACITY]’ as ‘[usize]’ [E0620]
7 | let x = &[1_usize, 2] as [usize];
| ^ ~
~/gccrs/gcc/testsuite/rust/compile/all-cast.rs:10:18: error: casting ‘& u8’ as ‘u32’ is invalid [E0606]
10 | let y: u32 = a as u32;
| ^ ~~~
```
## Bugs Finding:
A comprehensive compilation of the bugs I discovered is available on the dedicated [bugs page](https://mahadmuhammad.github.io/gsoc/23/r/issues/). Among these, here are several intriguing bugs captured my attention and were successfully resolved over the course of my project:
### ICE with return expression outside of context:
One of the intriguing bugs uncovered during the investigation of error codes in gccrs pertained to an `internal compiler error - ICE`. Specifically, gccrs encountered issues when attempting to access an empty stack, which not only posed a security concern but was also not permitted in rustc. This issue has now been addressed, resulting in the proper emission of error codes and messages, aligning with the behavior in rustc.
```rust
const FOO: u32 = return 0;
```
Previously, this triggered an error causing an internal compiler error. Now, the issue is rectified, and gccrs emits the appropriate error code and message, in line with rustc's behavior.
```bash
empty-stack.rs:1:18: error: return statement outside of function body [E0572]
1 | const FOO: u32 = return 0; // error: return statement outside of function body
| ^~~~~~
```
### Resolve type path error:
I raised an issue that played a pivotal role in identifying and addressing an issue that contributed to enabling proper support for `?Sized` and `Sized` trait bounds within the gccrs. This issue was subsequently resolved by my mentor.
## Contributions Overview:
### Pull Requests:
For a comprehensive overview of the pull requests I've submitted, visit [pull requests page](https://mahadmuhammad.github.io/gsoc/23/r/pulls/). Alternatively, you can also view the pull requests I've initiated on [GitHub](https://github.com/Rust-GCC/gccrs/pulls?q=is%3Apr+author%3AMahadMuhammad+created%3A%3C%3D2023-09-10+) and on this [tracking issue](https://github.com/Rust-GCC/gccrs/issues/2553).
### Issues:
To delve deeper into the intricacies of the issues I've engaged with, feel free to explore the dedicated [issue page](https://mahadmuhammad.github.io/gsoc/23/r/issues/). Furthermore, you can also explore the issues I've raised, all viewable on [GitHub](https://github.com/Rust-GCC/gccrs/issues?q=is%3Aissue+author%3AMahadMuhammad+created%3A%3C%3D2023-09-10+) and also on this [tracking issue](https://github.com/Rust-GCC/gccrs/issues/2553).
## Learning Journey:
### Gained Insights:
- The most significant skill I acquired involved navigating extensive C++ codebases. It was my inaugural experience with such immense code complexity.
- Moreover, I delved into the intricacies of compiler internals, unveiling operational nuances beyond the scope of conventional academic compiler courses.
- Mastered effective communication and collaborative problem-solving. Despite my initial apprehension towards English communication, the unwavering support and encouragement from my mentors facilitated a transformative shift, enabling me to overcome this fear and communicate more confidently.
- Embraced a paradigm shift: Prioritizing progress over perfection. A sage piece of advice from my mentor, [Philip Herron](https://github.com/philberty/), catalyzed my work approach.
- Leveraged automation for productivity enhancement and error reduction:
- Utilized [Python-driven](https://gist.github.com/MahadMuhammad/8c9d5fc88ea18d8c520937a8071d4185#file-rustc-errorcode-parser-py) automation to validate error codes and messages. This approach streamlined the process, obviating manual effort and minimizing error risks.
- Honed time and project management adeptness using versatile tools, notably [GitHub Projects](https://github.com/users/MahadMuhammad/projects/7/views/1)
### Overcoming Challenges:
In my initial attempts, I encountered difficulty in successfully passing the evaluations carried out by the CI/CD system. In this context, my mentor [Arthur Cohen](https://github.com/cohenarthur/) guided me to pass the CI/CD. Moreover, during this collaborative effort, we uncovered a weakness within the current CI/CD framework, highlighted in this particular issue: [CI fails if test file contains the word "unexpected" or "unresolved" #2386](https://github.com/Rust-GCC/gccrs/issues/2386).
## Work for the future:
- Expanding the range of error codes and messages to cover more scenarios.
- Updating the error handling code for the existing error codes to incorporate `rich locations`, which offer more details about the error location, and facilitate users and developers to debug and enhance their code.
## Acknowledgements
I am very grateful to the following people who made this project possible and supported me throughout the process. Their expertise, feedback and encouragement were invaluable for me.
- [Philip Herron](https://github.com/philberty/) & [Arthur Cohen](https://github.com/cohenarthur/) for being my amazing mentors and guiding me with their insights and experience.
- [Pierre Emmanuel Patry](https://github.com/P-E-P/) for reviewing my code and giving me helpful suggestions. Also, [Marc Poulhiès](https://github.com/dkm), [Thomas Schwinge](https://github.com/tschwinge), [Philipp Krones](https://github.com/flip1995/) for sharing their knowledge and tips with me.
- And last but not least, [Faisal Abbas](https://github.com/abbasfaisal/) for assisting me in my initial contributions and helping me with my proposal.
# Issue Page:
You can also explore the issues I've raised, all viewable on [GitHub](https://github.com/Rust-GCC/gccrs/issues?q=is%3Aissue+author%3AMahadMuhammad+created%3A%3C%3D2023-09-10+) and on this [tracking issue](https://github.com/Rust-GCC/gccrs/issues/2553).
Here's a compilation of the issues I initiated and contributed to throughout the project:
1. [ErrorCode Support #2553](https://github.com/Rust-GCC/gccrs/issues/2553)
1. [ICE - Expected `Type` got something else #2479](https://github.com/Rust-GCC/gccrs/issues/2479)
1. [ICE - Segmentation fault after `unknown trait item` #2478](https://github.com/Rust-GCC/gccrs/issues/2478)
1. [ICE - return outside function #2477](https://github.com/Rust-GCC/gccrs/issues/2477)
1. [Resolve type path error #2375](https://github.com/Rust-GCC/gccrs/issues/2375)
1. [Location Info error for "multiple applicable items in scope for: test" #2366](https://github.com/Rust-GCC/gccrs/issues/2366)
1. [Refactoring Field Error Function into one Function #2336](https://github.com/Rust-GCC/gccrs/issues/2336)
1. [Cannot find path `x` in this scope #2509](https://github.com/Rust-GCC/gccrs/issues/2509)
1. [Neither tuple struct nor a tuple variant was used as a pattern - Internal Compiler Error #2430](https://github.com/Rust-GCC/gccrs/issues/2430)
1. [Error Variadic Parameters - [E0045] #2382](https://github.com/Rust-GCC/gccrs/issues/2382)
1. [ICE on match expression without any match arms #2567](https://github.com/Rust-GCC/gccrs/issues/2567)
1. [ICE when binding `richloc` to paser errors #2566](https://github.com/Rust-GCC/gccrs/issues/2566)
1. [ICE - when `impl Trait` type expands to a recursive type `[E0720]` #2523](https://github.com/Rust-GCC/gccrs/issues/2523)
1. [Change `ErrorCode` location after the `error:` #2522](https://github.com/Rust-GCC/gccrs/issues/2522)
1. [Invalid `repr options` error support](https://github.com/Rust-GCC/gccrs/issues/2517)
1. [ICE - cannot mix `bin` crate type with others - `[E0601]` #2512](https://github.com/Rust-GCC/gccrs/issues/2512)
1. [missing unreachable pattern `[E0001]` warning #2511](https://github.com/Rust-GCC/gccrs/issues/2511)
1. [ICE - `Copy` trait was implemented on `Drop implementation type` - [E0184] #2510](https://github.com/Rust-GCC/gccrs/issues/2510)
1. [refutable pattern in local binding - `[E0005]` #2508](https://github.com/Rust-GCC/gccrs/issues/2508)
1. [Invalid `self` import was made #2501](https://github.com/Rust-GCC/gccrs/issues/2501)
1. [method / constant was impl on primitive type #2500](https://github.com/Rust-GCC/gccrs/issues/2500)
1. [ICE when non-trait type was used in trait position #2499](https://github.com/Rust-GCC/gccrs/issues/2499)
1. [ICE - when `if` contains `&str` instead of `bool` #2495](https://github.com/Rust-GCC/gccrs/issues/2495)
1. [Wrong Error on `E0438` #2481](https://github.com/Rust-GCC/gccrs/issues/2481)
1. [Wrong error when loop keyword used outside loop but inside closure - `E0267` #2454](https://github.com/Rust-GCC/gccrs/issues/2454)
1. [Refactor `redefined multiple times` Error #2436](https://github.com/Rust-GCC/gccrs/issues/2436)
1. [Invalid Error Code for Attempted to call something which isn't a function nor a method. [E0618] #2434](https://github.com/Rust-GCC/gccrs/issues/2434)
1. [Invalid Error Code for E0423 #2433](https://github.com/Rust-GCC/gccrs/issues/2433)
1. [Inherit Implementation of type outside current crate - Internal Compile Error #2423](https://github.com/Rust-GCC/gccrs/issues/2423)
1. [Failed to evaluate constant value #2394](https://github.com/Rust-GCC/gccrs/issues/2394)
1. [Invalid LHS Of Assignment #2391](https://github.com/Rust-GCC/gccrs/issues/2391)
1. [Error - Unable to find lang-item & cannot apply operation to types #2384](https://github.com/Rust-GCC/gccrs/issues/2384)
1. [initializer & field location info missing in Error message #2388](https://github.com/Rust-GCC/gccrs/issues/2388)
1. [No fields in initializer - Internal compiler error #2389](https://github.com/Rust-GCC/gccrs/issues/2389)
1. [Fatal Error: used more than once - [E0062] #2381](https://github.com/Rust-GCC/gccrs/issues/2381)
1. [Location Info error for "missing function in trait implementation" #2378](https://github.com/Rust-GCC/gccrs/issues/2378)
1. [Error: Type or Const Parameters on Foreign Items #2376](https://github.com/Rust-GCC/gccrs/issues/2376)
1. [Associated Type Binding - Internal Compile Error #2369](https://github.com/Rust-GCC/gccrs/issues/2369)
1. [Location Info error for "associated type bindings" #2368](https://github.com/Rust-GCC/gccrs/issues/2368)
1. [Expected tuple struct or tuple variant, found struct variant [E0532] #2324](https://github.com/Rust-GCC/gccrs/issues/2324)
1. [Non-Exhaustive Patterns: Matching Error (E0004) #2311](https://github.com/Rust-GCC/gccrs/issues/2311)
1. [CI fails if test file contains the word "unexpected" or "unresolved" #2386](https://github.com/Rust-GCC/gccrs/issues/2386)
1. [Improve `ErrorCode framework #2452](https://github.com/Rust-GCC/gccrs/issues/2452)
1. [Have error classes for simpler emission and more factoring #1420](https://github.com/Rust-GCC/gccrs/issues/1420)
# Pulls Page:
You can also view the pull requests I've initiated on [GitHub](https://github.com/Rust-GCC/gccrs/pulls?q=is%3Apr+author%3AMahadMuhammad+created%3A%3C%3D2023-09-10+) and on this [tracking issue](https://github.com/Rust-GCC/gccrs/issues/2553).
Here's the compilation of pull requests I initiated and actively worked on during the course of the project:
- [New Error Code Framework #2468](https://github.com/Rust-GCC/gccrs/pull/2468)
- [Support for rich-loc & errorcode in parser & expansion errors #2542](https://github.com/Rust-GCC/gccrs/pull/2542)
- [Diagnostics: Added non-const `rich_location *` function #2574](https://github.com/Rust-GCC/gccrs/pull/2574)
- [[E0054-E0604-E0620-E0606] TypeCasting ErrorCodes #2528](https://github.com/Rust-GCC/gccrs/pull/2528)
- [[E0599] Failed to resovle method implementation #2571](https://github.com/Rust-GCC/gccrs/pull/2571)
- [Top level or-patterns are not allowed let binding #2569](https://github.com/Rust-GCC/gccrs/pull/2569)
- [[E0573] Something other than type was used #2568](https://github.com/Rust-GCC/gccrs/pull/2568)
- [[E0164] Neither tuple struct nor tuple variant used as a pattern #2565](https://github.com/Rust-GCC/gccrs/pull/2565)
- [[E0769] Use of struct or tuple variant in struct or struct variant #2564](https://github.com/Rust-GCC/gccrs/pull/2564)
- [[E0532] Pattern arm did not match expected kind. #2563](https://github.com/Rust-GCC/gccrs/pull/2563)
- [[E0271] Type mismatch between associated type trait. #2562](https://github.com/Rust-GCC/gccrs/pull/2562)
- [[E0391] Detected type dependency cycle #2561](https://github.com/Rust-GCC/gccrs/pull/2561)
- [[E0034] found more than one items for method #2560](https://github.com/Rust-GCC/gccrs/pull/2560)
- [[E0535] Unknown argument given to inline attribute #2559](https://github.com/Rust-GCC/gccrs/pull/2559)
- [[E0534] inline attribute was malformed #2558](https://github.com/Rust-GCC/gccrs/pull/2558)
- [Invalid order of generic parameters #2557](https://github.com/Rust-GCC/gccrs/pull/2557)
- [Non-allowed default type paramters #2556](https://github.com/Rust-GCC/gccrs/pull/2556)
- [[E0592] method or associated functions already defined with same names #2555](https://github.com/Rust-GCC/gccrs/pull/2555)
- [[E0107] Wrong number of generic argument #2539](https://github.com/Rust-GCC/gccrs/pull/2539)
- [[E0015] Use of non-const inside const #2538](https://github.com/Rust-GCC/gccrs/pull/2538)
- [[E0658] Use of mutable reference in constant functions. #2536](https://github.com/Rust-GCC/gccrs/pull/2536)
- [[E0412] used type name not in scope #2534](https://github.com/Rust-GCC/gccrs/pull/2534)
- [[E0753] Use of inner doc comment in invalid context #2531](https://github.com/Rust-GCC/gccrs/pull/2531)
- [[E0380] Use of auto trait with method or associated item #2527](https://github.com/Rust-GCC/gccrs/pull/2527)
- [[E0541] Use of unknown meta item #2526](https://github.com/Rust-GCC/gccrs/pull/2526)
- [[E0308] array misamatch types #2525](https://github.com/Rust-GCC/gccrs/pull/2525)
- [[E0282] type annotations needed #2524](https://github.com/Rust-GCC/gccrs/pull/2524)
- [[E0703] Use of Invalid ABI #2519](https://github.com/Rust-GCC/gccrs/pull/2519)
- [[E0635] Use of Unknown feature. #2513](https://github.com/Rust-GCC/gccrs/pull/2513)
- [[E0426] Use of undeclared label #2502](https://github.com/Rust-GCC/gccrs/pull/2502)
- [[E0308] mismatch types on both sides of assignment Operator #2494](https://github.com/Rust-GCC/gccrs/pull/2494)
- [[E0572] return is outside of function context #2493](https://github.com/Rust-GCC/gccrs/pull/2493)
- [[E0571] break with argument in non-loop loop #2455](https://github.com/Rust-GCC/gccrs/pull/2455)
- [[E0268] break or continue used outside of loop #2453](https://github.com/Rust-GCC/gccrs/pull/2453)
- [[E0045] Variadic Parameters Used on Non-C ABI Function #2451](https://github.com/Rust-GCC/gccrs/pull/2451)
- [[E0323] Implemented associated const, expected another trait #2445](https://github.com/Rust-GCC/gccrs/pull/2445)
- [[E0423] expected function, tuple struct or tuple variant, found struct #2432](https://github.com/Rust-GCC/gccrs/pull/2432)
- [[E0133] Use of unsafe code outside of unsafe function or block #2424](https://github.com/Rust-GCC/gccrs/pull/2424)
- [[E0658] Use of unstable feature #2408](https://github.com/Rust-GCC/gccrs/pull/2408)
- [[E0093] Declaration of unknown intrinsic function #2407](https://github.com/Rust-GCC/gccrs/pull/2407)
- [[E0124] field `x` is already declared in struct #2397](https://github.com/Rust-GCC/gccrs/pull/2397)
- [[E0070] invalid left-hand side of assignment #2390](https://github.com/Rust-GCC/gccrs/pull/2390)
- [[E0063] constructor is missing fields #2387](https://github.com/Rust-GCC/gccrs/pull/2387)
- [[E0425] Use of unresolved name #2383](https://github.com/Rust-GCC/gccrs/pull/2383)
- [[E0053] method 'x' has an incompatible type for trait 'y' #2380](https://github.com/Rust-GCC/gccrs/pull/2380)
- [[E0046] Missing Items in Trait Implementation #2377](https://github.com/Rust-GCC/gccrs/pull/2377)
- [[E0061] Refactored argument mismatch error function #2373](https://github.com/Rust-GCC/gccrs/pull/2373)
- [[E0229] associated type bindings error #2367](https://github.com/Rust-GCC/gccrs/pull/2367)
- [[E0034] Ambiguous Method Call Error #2365](https://github.com/Rust-GCC/gccrs/pull/2365)
- [Refactored Field Error Function #2341](https://github.com/Rust-GCC/gccrs/pull/2341)
- [[E0027] struct pattern fails to specify struct's fields #2335](https://github.com/Rust-GCC/gccrs/pull/2335)
- [[E0026] Non-Existent Field Extraction in Struct Pattern #2326](https://github.com/Rust-GCC/gccrs/pull/2326)
- [[E0023] Incorrect Number of Fields in Pattern Extraction #2325](https://github.com/Rust-GCC/gccrs/pull/2325)
- [ErrorCode[E0277] Type Does Not Implement Expected Trait #2315](https://github.com/Rust-GCC/gccrs/pull/2315)
- [ErrorCode[E0433]: Use of Undeclared Crate, Module, or Type #2301](https://github.com/Rust-GCC/gccrs/pull/2301)
---
# Relative to rustc Page:
### gccrs error code support 🦀
There are some errors which are not longer emitted by [rustc-1.49.0](https://github.com/rust-lang/rust/releases/tag/1.49.0).
| **Error code** | Is Emitted by **rustc-1.49.0** | Is Error generated by **gccrs** | Error support in gccrs | Description |
| :---: | :---: | :---: | :---: | :---: |
| [`E0001`](https://doc.rust-lang.org/error_codes/E0001.html) | No | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2511) | Unreachable Pattern in Match Statement |
| [`E0002`](https://doc.rust-lang.org/error_codes/E0002.html) | No | No | - | Empty Match Expression on Non-Empty Type |
| [`E0004`](https://doc.rust-lang.org/error_codes/E0004.html) | Yes | No | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2311) | Non-Exhaustive Patterns: Matching Error |
| [`E0005`](https://doc.rust-lang.org/error_codes/E0005.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2508) | Patterns used to bind names must be `irrefutable`, that is, they must guarantee that a name will be extracted in all cases. |
| [`E0007`](https://doc.rust-lang.org/error_codes/E0007.html) | No | Yes | No | cannot bind by-move with sub-bindings |
| [`E0010`](https://doc.rust-lang.org/error_codes/E0010.html) | Yes | Yes | No | allocations are not allowed in constants |
| [`E0015`](https://doc.rust-lang.org/error_codes/E0015.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2538) | A non-const function was called in a const context. |
| [`E0023`](https://doc.rust-lang.org/error_codes/E0023.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2325) | Incorrect Number of Fields in Pattern Extraction |
| [`E0026`](https://doc.rust-lang.org/error_codes/E0026.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2326) | Non-Existent Field Extraction in Struct Pattern `also need to refactor this`|
| [`E0027`](https://doc.rust-lang.org/error_codes/E0027.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2335) | A pattern for a struct fails to specify a sub-pattern for every one of the struct's fields. |
| [`E0029`](https://doc.rust-lang.org/error_codes/E0029.html) | Yes | Yes | No | Non-Comparable Range Error (Something other than numbers and characters has been used for a range) |
| [`E0030`](https://doc.rust-lang.org/error_codes/E0030.html) | Yes | No | - | Empty Range Pattern Error |
| [`E0033`](https://doc.rust-lang.org/error_codes/E0033.html) | Yes | Yes | No | A trait type has been dereferenced (Internal Compile error in gccrs) |
| [`E0034`](https://doc.rust-lang.org/error_codes/E0034.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2365) [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2366) [`Issue-Fix`](https://github.com/Rust-GCC/gccrs/pull/2560) | Ambiguous Method Call Error - more than one method has the same prototype | <!-- PR need to be merged-->
| [`E0038`](https://doc.rust-lang.org/error_codes/E0038.html) | Yes | Yes | No - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2375) | Traits that are declared as Trait: Sized or which otherwise inherit a constraint of Self:Sized are not object-safe. |
| [`E0040`](https://doc.rust-lang.org/error_codes/E0040.html) | Yes | Yes | No | Explicit use of destructor method |
| [`E0044`](https://doc.rust-lang.org/error_codes/E0044.html) | Yes | No | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2376) | Type or Const Parameters Not Allowed on Foreign Items |
| [`E0045`](https://doc.rust-lang.org/error_codes/E0045.html) | Yes | No | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2451) - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2382) | Variadic Parameters Used on Non-C ABI Function |
| [`E0046`](https://doc.rust-lang.org/error_codes/E0046.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2377) | Missing Items in Trait Implementation - [Issue](https://github.com/Rust-GCC/gccrs/issues/2378)|
| [`E0049`](https://doc.rust-lang.org/error_codes/E0049.html) | Yes | Yes | No | An attempted implementation of a trait method has the wrong number of type or const parameters - [Error Link](https://godbolt.org/z/fvfaW3Kn5) |
| [`E0050`](https://doc.rust-lang.org/error_codes/E0050.html) | Yes | Yes | No | An attempted implementation of a trait method has the wrong number of function parameters - [`godbolt-link](https://godbolt.org/z/8Waa3KK19) - [`gccrs error - rustc fine`](https://godbolt.org/z/x6PE6n14v) |
| [`E0053`](https://doc.rust-lang.org/error_codes/E0053.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2380) | The parameters of any trait method must match between a trait implementation and the trait definition - method 'x' has an incompatible type for trait 'y' |
| [`E0054`](https://doc.rust-lang.org/error_codes/E0054.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2528) | Invalid Cast of `Integer` to `Bool` |
| [`E0055`](https://doc.rust-lang.org/error_codes/E0055.html) | Yes | Yes | No - need review | Recursion Limit Exceeded |
| [`E0057`](https://doc.rust-lang.org/error_codes/E0057.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2384) | An invalid number of arguments was given when calling a closure - [`compiler-explorer`](https://godbolt.org/z/T9dW7z7Ws) |
| [`E0059`](https://doc.rust-lang.org/error_codes/E0059.html) | Yes | Yes | No | Incorrect Usage of Angle-Bracket Notation in Function Traits - (Failed to resolve type path error) |
| [`E0060`](https://doc.rust-lang.org/error_codes/E0060.html) | Yes | Yes | No | Variadic Function Requires Minimum Number of Arguments - (likewise same as failed to resolve type path in this scope) |
| [`E0061`](https://doc.rust-lang.org/error_codes/E0061.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2373) | Invalid number of arguments was passed when calling a function - unexpected number of arguments `x` expected `y` |
| [`E0062`](https://doc.rust-lang.org/error_codes/E0062.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2381) | A struct's or struct-like enum variant's field was specified more than once. |
| [`E0063`](https://doc.rust-lang.org/error_codes/E0063.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2387) - [`Missing-Location-info-ISSUE`](https://github.com/Rust-GCC/gccrs/issues/2388) - [`no-fields-in-constructor`](https://github.com/Rust-GCC/gccrs/issues/2389) | Missing Field in Struct or Struct-like Enum Variant - constructor is missing fields |
| [`E0069`](https://doc.rust-lang.org/error_codes/E0069.html) | Yes | Yes | No - Work on this later | Mismatch between function `return` type & the value being returned |
| [`E0070`](https://doc.rust-lang.org/error_codes/E0070.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2390) - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2391) | An assignment operator was used on a non-place expression. |
| [`E0071`](https://doc.rust-lang.org/error_codes/E0071.html) | Yes | Yes | No - Work on this later | A structure-literal syntax was used to create an item that is not a structure or enum variant. |
| [`E0072`](https://doc.rust-lang.org/error_codes/E0072.html) | Yes | Yes | No - Work on this later | A recursive type has infinite size because it doesn't have an indirection. |
| [`E0073`](https://doc.rust-lang.org/error_codes/E0073.html) | Yes | Yes | No - Work on this later | You cannot define a struct (or enum) Foo that requires an instance of Foo in order to make a new Foo value. |
| [`E0074`](https://doc.rust-lang.org/error_codes/E0074.html) | Yes | Yes | No - Work on this later -smid feature | When using the #[simd] attribute on a tuple struct, the components of the tuple struct must all be of a concrete, nongeneric type so the compiler can reason about how to use SIMD with them. |
| [`E0075`](https://doc.rust-lang.org/error_codes/E0075.html) | Yes | Yes | No - Work on this later - simd macro error| A #[simd] attribute was applied to an empty tuple struct. |
| [`E0076`](https://doc.rust-lang.org/error_codes/E0076.html) | Yes | Yes | No - Work on this later - simd macro error | All types in a tuple struct aren't the same when using the #[simd] attribute.|
| [`E0077`](https://doc.rust-lang.org/error_codes/E0077.html) | Yes | Yes | No - Work on this later - simd macro error | A tuple struct's element isn't a machine type when using the #[simd] attribute. |
| [`E0080`](https://doc.rust-lang.org/error_codes/E0080.html) | Yes | Yes | No -[`Issue-link`](https://github.com/Rust-GCC/gccrs/issues/2394) | A constant value failed to get evaluated. |
| [`E0081`](https://doc.rust-lang.org/error_codes/E0081.html) | Yes | Yes | No | A discriminant value is present more than once. |
| [`E0093`](https://doc.rust-lang.org/error_codes/E0093.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2407) | An unknown intrinsic function was declared.|
| [`E0107`](https://doc.rust-lang.org/error_codes/E0107.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2539) | An incorrect number of generic arguments was provided. |
| [`E0116`](https://doc.rust-lang.org/error_codes/E0116.html) | Yes | Yes | `NO - Internal compile Error` | An inherent implementation was defined for a type outside the current crate. |
| [`E0124`](https://doc.rust-lang.org/error_codes/E0124.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2397) | A struct was declared with two fields having the same name. |
| [`E0133`](https://doc.rust-lang.org/error_codes/E0133.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2424) | Unsafe code was used outside of an unsafe function or block. |
| [`E0164`](https://doc.rust-lang.org/error_codes/E0164.html) | Yes | Yes | No - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2430) | Something which is neither a tuple struct nor a tuple variant was used as a pattern. |
| [`E0184`](https://doc.rust-lang.org/error_codes/E0184.html) | Yes | Yes | ICE - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2510)| the trait `Copy` may not be implemented for this type; the type has a destructor |
| [`E0229`](https://doc.rust-lang.org/error_codes/E0229.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2367) | Associated Type Binding Outside of Type Parameter Declaration and Where Clause |
| [`E0267`](https://doc.rust-lang.org/error_codes/E0267.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2454) | A loop keyword (break or continue) was used inside a closure but outside of any loop. |
| [`E0268`](https://doc.rust-lang.org/error_codes/E0268.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2453) | A loop keyword (break or continue) was used outside of a loop. |
| [`E0271`](https://doc.rust-lang.org/error_codes/E0271.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2562) | A type mismatched an associated type of a trait. |
| [`E0277`](https://doc.rust-lang.org/error_codes/E0277.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2315) | Type Does Not Implement Expected Trait - the type `[{integer}]` cannot be indexed by `u32` | <!-- Done. Need Review -->
| [`E0282`](https://doc.rust-lang.org/error_codes/E0282.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2524) | The compiler could not infer a type and asked for a type annotation. |
| [`E0303`](https://doc.rust-lang.org/error_codes/E0303.html) | No | Yes | No - Added as subtask on [#2509](https://github.com/Rust-GCC/gccrs/issues/2509) | pattern bindings are not allowed after an `@` |
| [`E0308`](https://doc.rust-lang.org/error_codes/E0308.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2494) [`array-case`](https://github.com/Rust-GCC/gccrs/pull/2525) | Expected type did not match the received type. |
| [`E0323`](https://doc.rust-lang.org/error_codes/E0323.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2445) | An associated const was implemented when another trait item was expected. |
| [`E0324`](https://doc.rust-lang.org/error_codes/E0324.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2478) - No | A method was implemented when another trait item was expected. |
| [`E0380`](https://doc.rust-lang.org/error_codes/E0380.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2527) | An auto trait was declared with a method or an associated item. |
| [`E0390`](https://doc.rust-lang.org/error_codes/E0390.html) | Yes | No | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2500) No (Raise issue- https://godbolt.org/z/Pr3ae4ovP) | A method or constant was implemented on a primitive type. |
| [`E0391`](https://doc.rust-lang.org/error_codes/E0391.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2561) | A type dependency cycle has been encountered. |
| [`E0404`](https://doc.rust-lang.org/error_codes/E0404.html) | Yes | Yes | ICE - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2499) | A type that is not a trait was used in a trait position, such as a bound or impl. |
| [`E0412`](https://doc.rust-lang.org/error_codes/E0412.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2534) | A used type name is not in scope. |
| [`E0423`](https://doc.rust-lang.org/error_codes/E0423.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2432) - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2433) | An identifier was used like a function name or a value was expected and the identifier exists but it belongs to a different namespace. |
| [`E0425`](https://doc.rust-lang.org/error_codes/E0425.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2383) | Use of unresolved name |
| [`E0426`](https://doc.rust-lang.org/error_codes/E0426.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2502) | An undeclared label was used. |
| [`E0431`](https://doc.rust-lang.org/error_codes/E0431.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2501) - No | An invalid self import was made. |
| [`E0433`](https://doc.rust-lang.org/error_codes/E0433.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2301) | Failed to resolve. Use of Undeclared Crate, Module, or Type | <!-- PR Merged https://github.com/Rust-GCC/gccrs/pull/2301 -->
| [`E0532`](https://doc.rust-lang.org/error_codes/E0532.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2563) | Arm Does Not Match Expected Kind - expected tuple struct or tuple variant, found struct variant |
| [`E0534`](https://doc.rust-lang.org/error_codes/E0534.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2558) | The inline attribute was malformed. |
| [`E0535`](https://doc.rust-lang.org/error_codes/E0535.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2559) | An unknown argument was given to the inline attribute. |
| [`E0541`](https://doc.rust-lang.org/error_codes/E0541.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2526) | An unknown meta item was used. |
| [`E0554`](https://doc.rust-lang.org/error_codes/E0554.html) | Yes | Yes | No | Feature attributes are only allowed on the nightly release channel. |
| [`E0571`](https://doc.rust-lang.org/error_codes/E0571.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2455) | A break statement with an argument appeared in a non-`loop` loop. |
| [`E0572`](https://doc.rust-lang.org/error_codes/E0572.html) | Yes | Yes | [`YES`](https://github.com/Rust-GCC/gccrs/pull/2493) [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2477) (ICE)| A return statement was found outside of a function body. |
| [`E0573`](https://doc.rust-lang.org/error_codes/E0573.html) | Yes | Yes | [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2479) [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2568) | Something other than a type has been used when one was expected. |
| [`E0592`](https://doc.rust-lang.org/error_codes/E0592.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2555) | This error occurs when you defined methods or associated functions with same name. |
| [`E0599`](https://doc.rust-lang.org/error_codes/E0599.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2571) | This error occurs when a method is used on a type which doesn't implement it: |
| [`E0601`](https://doc.rust-lang.org/error_codes/E0601.html) | Yes | Yes | ICE - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2512) | No main function was found in a binary crate. |
| [`E0604`](https://doc.rust-lang.org/error_codes/E0604.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2528) | A cast to `char` was attempted on a type other than `u8` | <!-- The error point of this and E0054 are same, need to work on this -->
| [`E0605`](https://doc.rust-lang.org/error_codes/E0605.html) | Yes | Yes | Need Rust standad library [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2528) | An invalid cast was attempted. |
| [`E0606`](https://doc.rust-lang.org/error_codes/E0606.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2528) | An incompatible cast was attempted. |
| [`E0607`](https://doc.rust-lang.org/error_codes/E0607.html) | Yes | Yes | No [`Need rust sl`](https://github.com/Rust-GCC/gccrs/pull/2528) | A cast between a thin and a fat pointer was attempted. |
| [`E0618`](https://doc.rust-lang.org/error_codes/E0618.html) | Yes | Yes | No | Attempted to call something which isn't a function nor a method. |
| [`E0620`](https://doc.rust-lang.org/error_codes/E0620.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2528) | A cast to an unsized type was attempted. |
| [`E0623`](https://doc.rust-lang.org/error_codes/E0623.html) | Yes | Yes | No - [`Need rust sl`](https://github.com/Rust-GCC/gccrs/pull/2528) | A lifetime didn't match what was expected. |
| [`E0635`](https://doc.rust-lang.org/error_codes/E0635.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2513) | The #![feature] attribute specified an unknown feature. |
| [`E0641`](https://doc.rust-lang.org/error_codes/E0641.html) | Yes | Yes | No - [`Need rust sl`](https://github.com/Rust-GCC/gccrs/pull/2528) | Attempted to cast to/from a pointer with an unknown kind. |
| [`E0658`](https://doc.rust-lang.org/error_codes/E0658.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2408) [`mut-ref`](https://github.com/Rust-GCC/gccrs/pull/2536) [`Top level patterns in le experssion`](https://github.com/Rust-GCC/gccrs/pull/2569) | An unstable feature was used |
| [`E0703`](https://doc.rust-lang.org/error_codes/E0703.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2519) | Invalid ABI (Application Binary Interface) used in the code. |
| [`E0720`](https://doc.rust-lang.org/error_codes/E0720.html) | Yes | Yes | ICE - [`Issue`](https://github.com/Rust-GCC/gccrs/issues/2523) | An impl Trait type expands to a recursive type. |
| [`E0753`](https://doc.rust-lang.org/error_codes/E0753.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2531) | An inner doc comment was used in an invalid context. |
| [`E0769`](https://doc.rust-lang.org/error_codes/E0769.html) | Yes | Yes | [`Yes`](https://github.com/Rust-GCC/gccrs/pull/2564) | A tuple struct or tuple variant was used in a pattern as if it were a struct or struct variant. |
| [`E0781`](https://doc.rust-lang.org/error_codes/E0781.html) | Yes | Yes | No - [`Need rust sl`](https://github.com/Rust-GCC/gccrs/pull/2528) | The C-cmse-nonsecure-call ABI can only be used with function pointers. |
---