-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Mark desugaring of ..= as such when lowering
#136996
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? @davidtwco rustbot has assigned @davidtwco. Use |
compiler-errors
left a comment
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.
Why is this special-cased for RangeClosed? Shouldn't this also be applied to the open ranges?
0ae7320 to
4a79dd3
Compare
Other kind of ranges build a
|
This comment has been minimized.
This comment has been minimized.
4a79dd3 to
bafcb26
Compare
|
The compiler generally checks for |
We could specialize the MSRV check in Clippy to try and detect this desugaring, but we would have to also compare the source code strings to distinguish between a desugaring and a genuine user call to |
|
Writing |
Good point. While you're right on this, I can't understand if you're objecting to marking the desugaring as a desugaring and you suggest Clippy special-cases this particular desugaring MSRV (none other is), or if this was just a side remark. |
|
@matthewjasper While I would prefer to mark desugared hir as such, your comments made me realize that this is not necessary for what I want to achieve, as excluding all the I'll close this PR. |
When lowering,
a..=bis transformed intoRangeInclusive::new(a, b)without any desugaring information on the spans. It looks likea..=brequires Rust 1.27 (stabilization ofRangeInclusive::new()), whilea..=bwas introduced in Rust 1.26.Marking the desugaring as such in the HIR allows Clippy to filter it out and realize that this is not the original code coming from the user.