-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add span_end_line
to lints with spans
#1126
Conversation
(I don't expect this to get merged all at once. I just want feedback on how to best add these changes and make sure they are correct) |
I actually think this is completely fine to merge as-is, with just all the snapshot files updated. That's the beauty of using a query engine here. All these changes are guaranteed to be correct if all of the following hold:
Here's the adapter code in question that produces all the span info: It sure looks pretty reasonable to me! Starts use the So I'd say update all the snapshots in bulk, check one of them, and let's merge this :) |
I added the rest of the snapshots. My worry is that the |
It's entirely possible. But the easiest way to find the offending spans is to catch the "wrong"-ness, so I'm not particularly worried about it right now. Another idea for the future that will be useful as we consider upgrading the user experience (including the GitHub Action!) is the ability to emit multiple spans, so we can highlight multiple things at once. Consider rustc and clippy's diagnostics that are like "first, , then which is a problem." Something similar would be useful for us eventually, where we can say e.g. "this trait previously wasn't sealed , but now it's sealed because of item ." Obviously, this is material for future PRs — just sharing an idea. |
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.
Ah you have to capture this snapshot using Rust 1.85+ because before that, static safety data isn't available and the results end up empty. Sorry!
Rust 1.85 is beta at the moment but will become stable in just 2 weeks, and I didn't want to reject a useful lint over it. It does mean that regenerating this particular snapshot is a bit annoying though — sorry about 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.
cargo-semver-checks/src/query.rs
Line 757 in d69d820
&& rustc_version::version().is_ok_and(|version| version < Version::new(1, 85, 0)) |
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.
Yeah, I was using stable-generated rustdocs on nightly 🤦
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.
In two weeks that will be fine to do once again, and I'm excited for it!
Adds
end_line
to all lints that checkbegin_line
This is a draft because I don't know how best to review the new spans. I'm totally okay doing this lint-by-lint (or couple-lints-by-lint), and I have only checked a few of the generated new test outputs so far.
I quickly made a tool suaviloquence/print_spans_tool to help with reviewing the new spans, but I'd love your thoughts on how best to make this reviewable.