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 a distinct error code and description for "main function has wrong type" #37242

Closed
wants to merge 2 commits into from

Conversation

jfirebaugh
Copy link
Contributor

Followup to #36915. Adds a distinct error code and description for the "main function has wrong type" variant of E0308.

@rust-highfive
Copy link
Collaborator

r? @nrc

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -1424,6 +1424,14 @@ error. To resolve it, add an `else` block having the same type as the `if`
block.
"##,

E0318: r##"
The `main` function is required to have the signature `fn main() { ... }`, with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't need the { ... } in the signature

@nrc
Copy link
Member

nrc commented Oct 18, 2016

You'll need to use a fresh error code, rather than one that is already in use.

r=me with that and the nit above addressed.

@brson
Copy link
Contributor

brson commented Nov 9, 2016

Just waiting on updates from @jfirebaugh.

Error code 318 seems to be already allocated. You'll need to define a new one in librustc/diagnostics.rs. make tidy will output the highest recorded error number in its output, and you can pick the next.

@bors
Copy link
Contributor

bors commented Nov 10, 2016

☔ The latest upstream changes (presumably #37678) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez
Copy link
Member

For info, the actual biggest error code is E0570.

@jfirebaugh
Copy link
Contributor Author

I thought I had picked a unique one but I guess somehow I didn't search the whole tree. Switch to E0330.

@GuillaumeGomez
Copy link
Member

This is still the same issue: the E0330 exist**ed**.

@jfirebaugh
Copy link
Contributor Author

No, it's not the same issue.

@GuillaumeGomez
Copy link
Member

Then I don't understand... Like said, E0330 exist**ed** so you can't use it. Now please explain what I got wrong. :-/

@jfirebaugh
Copy link
Contributor Author

@GuillaumeGomez Sorry for my tone, I was in a grouchy mood and should have waited to comment.

The CI failure this time was due to a test case that had not been updated to the new error code. I don't see any indications in the repository history that E0330 has ever been used. Am I missing something?

~/Development/rust $ git log -S E0330
commit 3efcdba6010e1062977e193302bac73acffae13e
Author: John Firebaugh <john.firebaugh@gmail.com>
Date:   Sun Nov 13 15:43:27 2016 -0800

    Missed one compile test

commit 6bb4b84806b48cbf14ed0f6223a9bc8ea66285be
Author: John Firebaugh <john.firebaugh@gmail.com>
Date:   Sun Oct 2 17:03:28 2016 -0700

    Add a distinct error code and description for "main function has wrong type"
~/Development/rust $ 

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Nov 14, 2016

For some history reason, we don't reuse an error code. Then if it's lower than the actual highest error code I gave in a previous comment, then it has been used and shouldn't be reused. So even if you can't find it in the git logs, don't bother and create a new one higher than the actual highest one.

@steveklabnik
Copy link
Member

ping @jfirebaugh , are you still interested in updating this PR?

@jfirebaugh
Copy link
Contributor Author

No.

@jfirebaugh jfirebaugh closed this Jan 3, 2017
@jfirebaugh jfirebaugh deleted the E0308-split branch January 3, 2017 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants