-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix error warning span for issue12045 #12125
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
Conversation
r? @Manishearth (rustbot has picked a reviewer for you, use r? to override) |
r? @xFrednet |
Looks good to me, I love that the test code looks familiar ^^ Thank you for the update :D @bors r+ |
@bors r- |
Fix error warning span for issue12045 fixes [Issue#12045](#12045) In issue#12045, unexpected warning span occurs on attribute `#[derive(typed_builder::TypedBuilder)]`, actually the warning should underline `_lifetime`. In the source code we can find that the original intend is to warning on `ident.span`, but in this case, `stmt.span` is unequal with `ident.span`. So, fix the nit here is fine. Besides, `ident.span` have an accurate range than `stmt.span`. changelog: [`no_effect_underscore_binding`]: correct warning span
Wait, I like the change to the emission span, but I believe that it will not resolve the linked issue. The problem is, that the lint doesn't notice that the thing it lints, is inside derived code. The lint level is determined at the emission node, not in the span, so this change will still leave the FP. This is a nice update either way, but to solve this issue you probably need to add a check with |
☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
I have already fixed the addition question locally by add But sorry that the test seems not easy to add. I have figured out the issue is generate by derive node expansion, through marco If directly adding related issue code with Is is available to clarity this issue in test file comment instead of a test code? :) @xFrednet |
Sorry for the late response the end of my winter semester is killing me 😅
I don't see this change in this PR, have you done that part in a previous one? Regarding testing, this is sadly complicated for these kinds of macros. We have util for other macros, but apparently not derives. I checked the test for another lint and that one doesn't have tests for the derive case, so I think it's safe to close the issue if the |
hahhaha, no worries, it's fine. I fixed in one local commit, I haven't push yet beacuse of the complexity of test and was waiting your reply last several days. |
Thanks, looks good to me :) @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fixes Issue#12045
In issue#12045, unexpected warning span occurs on attribute
#[derive(typed_builder::TypedBuilder)]
, actually the warning should underline_lifetime
.In the source code we can find that the original intend is to warning on
ident.span
, but in this case,stmt.span
is unequal withident.span
. So, fix the nit here is fine.Besides,
ident.span
have an accurate range thanstmt.span
.changelog: [
no_effect_underscore_binding
]: correct warning span