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

Remove warning of duplicated error code #28666

Merged
merged 1 commit into from
Sep 27, 2015
Merged

Conversation

GuillaumeGomez
Copy link
Member

@bstrie
Copy link
Contributor

bstrie commented Sep 25, 2015

@GuillaumeGomez can you be more specific about what this does, for posterity? Is there an open issue for the correction here?

@GuillaumeGomez
Copy link
Member Author

It just removes the warning that the E0015 error code appears more than one in the code:

diagnostic code E0015 already used

@ebfull
Copy link
Contributor

ebfull commented Sep 26, 2015

I think the function (and the use of Session) should be closer in scope to the actual place it's used, since it's very specific for this situation and shouldn't be used elsewhere. Once const functions stabilize we can refactor it out.

On that note, it might be interesting to add a :reuse flag of some kind to the span_err! macro for this situation in the future, though it might not buy us much.

@Manishearth
Copy link
Member

The more idiomatic thing to do here is to use a single span_err call, and use an if to decide what string to pass it (let foo = if ...{format!(...)} else {format!(...)}; span_err(code, str))

@GuillaumeGomez
Copy link
Member Author

You're hard on business haha ! I moved the function to a more little scope as suggested.

@arielb1
Copy link
Contributor

arielb1 commented Sep 26, 2015

@GuillaumeGomez

Squash and use better names for the parameters (e.g. pass tcx instead of sess). r+ modulo that.

@GuillaumeGomez
Copy link
Member Author

@arielb1: Done !

@Manishearth
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 26, 2015

📌 Commit 22f7e96 has been approved by Manishearth

@arielb1
Copy link
Contributor

arielb1 commented Sep 26, 2015

@bors r-

Sorry, tcx: &Session just doesn't cut it (pass v.tcx - it has the type &ty::ctxt).

@GuillaumeGomez
Copy link
Member Author

Updated !

@arielb1
Copy link
Contributor

arielb1 commented Sep 26, 2015

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 26, 2015

📌 Commit 08181d2 has been approved by arielb1

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Sep 27, 2015
bors added a commit that referenced this pull request Sep 27, 2015
@bors bors merged commit 08181d2 into rust-lang:master Sep 27, 2015
@GuillaumeGomez GuillaumeGomez deleted the warning branch November 24, 2017 20:56
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.

6 participants