-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
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. |
Thanks for the PR! @bors r+ rollup |
📌 Commit 6d998d6 has been approved by |
@@ -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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Update E0392 to new error format Fixes rust-lang#35631. Part of rust-lang#35233 r? @jonathandturner or @GuillaumeGomez
Update E0392 to new error format Fixes rust-lang#35631. Part of rust-lang#35233 r? @jonathandturner or @GuillaumeGomez
Update E0392 to new error format Fixes rust-lang#35631. Part of rust-lang#35233 r? @jonathandturner or @GuillaumeGomez
Fixes #35631. Part of #35233
r? @jonathandturner or @GuillaumeGomez