-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Refactor Adjust and CastKind #59987
Refactor Adjust and CastKind #59987
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @oli-obk |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@oli-obk This is not yet ready. I have just made the changes to |
94d02eb
to
5be6b0b
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@oli-obk I have done a basic refactor of |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
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.
Just a nit, then this is ready to go!
src/librustc_mir/hair/cx/expr.rs
Outdated
Adjust::Pointer(PointerCast::UnsafeFnPointer) => { | ||
ExprKind::UnsafeFnPointer { source: expr.to_ref() } | ||
Adjust::Pointer(PointerCast::Unsize) => { | ||
if let ExprKind::Block { body } = expr.kind { |
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.
you lost the comment about looking at the comment on Adjust::Deref
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.
// See the above comment for Adjust::Deref
I thought the comment was misplaced. Why do we mention about Adjust::Deref
in Adjust::Unsize
?
Also, it does not seem like the existing "above comment" spoke about Adjust::Deref
.
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.
It's about the comment in line 94. This code exists solely to improve diagnostics. Maybe pull it out into a function instead of duplicating the logic?
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.
Added a new function adjust_span
for this.
You also need to update |
@oli-obk Made the fixes. |
@bors r+ Thanks! |
📌 Commit a2f8269 has been approved by |
Refactor Adjust and CastKind fixes #59588
☀️ Test successful - checks-travis, status-appveyor |
…casts-because-that-sounds-way-to-general-aaaa, r=oli-obk Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane. This enum was added in rust-lang#59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing. r? oli-obk
…casts-because-that-sounds-way-to-general-aaaa, r=oli-obk Rename `adjustment::PointerCast` and variants using it to `PointerCoercion` It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane. This enum was added in rust-lang#59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing. r? oli-obk
fixes #59588