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

Update E0392 to new error format #35671

Merged
merged 1 commit into from Aug 17, 2016
Merged

Update E0392 to new error format #35671

merged 1 commit into from Aug 17, 2016

Conversation

canova
Copy link
Contributor

@canova canova commented Aug 14, 2016

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jonathandturner (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@sophiajt
Copy link
Contributor

Thanks for the PR!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 14, 2016

📌 Commit 6d998d6 has been approved by jonathandturner

@@ -653,8 +653,10 @@ fn error_380(ccx: &CrateCtxt, span: Span) {

fn error_392<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, span: Span, param_name: ast::Name)
-> DiagnosticBuilder<'tcx> {
struct_span_err!(ccx.tcx.sess, span, E0392,
"parameter `{}` is never used", param_name)
let mut err = struct_span_err!(ccx.tcx.sess, span, E0392,
Copy link
Member

Choose a reason for hiding this comment

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

@jonathandturner: Don't you prefer doing this without declaring variable?

Copy link
Contributor Author

@canova canova Aug 15, 2016

Choose a reason for hiding this comment

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

@GuillaumeGomez Actually I tried it first but code like this turns mutable reference of DiagnosticBuilder because of span_label but return value of function is DiagnosticBuilder(not reference) so I couldn't do like that:

struct_span_err!(ccx.tcx.sess, span, E0392,
                     "parameter `{}` is never used", param_name)
                     .span_label(span, &format!("unused type parameter"))

I don't know another way to do it without declaring variable so I did it like that. If there is a better way, I'm happy to do that.

Copy link
Member

Choose a reason for hiding this comment

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

I thought the .emit() method would have done it. Have you tried it by any chance? Otherwise don't worry, it's just a detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried it but didn't worked. Returned DiagnosticBuilder variable emitting in another function.

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 15, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
bors added a commit that referenced this pull request Aug 17, 2016
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 17, 2016
bors added a commit that referenced this pull request Aug 17, 2016
@bors bors merged commit 6d998d6 into rust-lang:master Aug 17, 2016
@canova canova deleted the E0392 branch August 18, 2016 14:30
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.

None yet

5 participants