-
Notifications
You must be signed in to change notification settings - Fork 13k
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 error message E0120 #35298
Update error message E0120 #35298
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. |
Is there a better way to get the type name span? Also I guess I should put something other than |
There may be a better way to get the type name span, but if that works, it's fine with me. For Actually, in your case, can we do something more like: let mut err = struct_span_err!(tcx.sess, item.span, E0120,
"the Drop trait may only be implemented on structures");
match item.node {
ItemImpl(_, _, _, _, ref ty, _) => {
err.span = ty.span;
err.span_label(ty.span, &format!("implementing Drop requires a struct"));
},
_ => {
err.span_label(item.span, &format!("implementing Drop requires a struct"));
}
};
err.emit(); That way we can fall-back to the larger span if we have a node type we don't expect. |
Updated |
Even better :) Thanks! @bors r+ rollup |
📌 Commit 4492838 has been approved by |
Update error message E0120 Fixes rust-lang#35253 as part of rust-lang#35233. r? @jonathandturner
Update error message E0120 Fixes rust-lang#35253 as part of rust-lang#35233. r? @jonathandturner
Can you run:
and update this PR after fixing the tidy errors? |
@bors r- |
Sorry, updated |
No worries, thanks for updating. @bors r+ rollup |
📌 Commit 3b2f184 has been approved by |
Update error message E0120 Fixes rust-lang#35253 as part of rust-lang#35233. r? @jonathandturner
Update error message E0120 Fixes rust-lang#35253 as part of rust-lang#35233. r? @jonathandturner
Rollup of 30 pull requests - Successful merges: #34319, #35041, #35042, #35076, #35109, #35137, #35175, #35181, #35182, #35189, #35239, #35264, #35266, #35281, #35285, #35289, #35291, #35294, #35296, #35297, #35298, #35299, #35318, #35319, #35324, #35326, #35328, #35333, #35359, #35362 - Failed merges:
Fixes #35253 as part of #35233.
r? @jonathandturner