Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Error Index #1472

Open
willemneal opened this issue Sep 25, 2020 · 2 comments
Open

Add Error Index #1472

willemneal opened this issue Sep 25, 2020 · 2 comments

Comments

@willemneal
Copy link
Contributor

@willemneal willemneal commented Sep 25, 2020

Currently rust provides a page that has examples for each compiler error: https://doc.rust-lang.org/error-index.html

For example,

E0107

An incorrect number of generic arguments were provided.

Erroneous code example:

struct Foo<T> { x: T }

struct Bar { x: Foo }             // error: wrong number of type arguments:
                                  //        expected 1, found 0
struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
                                  //        expected 1, found 2

fn foo<T, U>(x: T, y: U) {}
fn f() {}

fn main() {
    let x: bool = true;
    foo::<bool>(x);                 // error: wrong number of type arguments:
                                    //        expected 2, found 1
    foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
                                    //        expected 2, found 3
    f::<'static>();                 // error: wrong number of lifetime arguments
                                    //        expected 0, found 1
}

They even let you run the code in a sandbox to see the error in action!

@dcodeIO dcodeIO added this to To do in Documentation via automation Sep 25, 2020
@Suket-shah
Copy link

@Suket-shah Suket-shah commented Oct 18, 2020

Hey! I am a CS student in college and I am interested in contributing to the open-source community. This is my first time trying to make contributions and I came across this issue due to its good first issue label. I wanted to see if there was a more in-depth explanation of what I could do to resolve this issue!

@willemneal
Copy link
Contributor Author

@willemneal willemneal commented Oct 27, 2020

Hey @Suket-shah! Glad to see you want to help. Here are the diagnostic messages

and you can open a pull request to the website and use snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Documentation
  
To do
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.