-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Use smaller span for adjustments on block expressions #53493
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
src/librustc_mir/hair/cx/expr.rs
Outdated
@@ -96,6 +96,14 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, | |||
ExprKind::Cast { source: expr.to_ref() } | |||
} | |||
Adjust::Deref(None) => { | |||
// Not needed in the next match arm since deref coercions always | |||
// start with a built-in 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.
I find this comment sort of confusing. I think you are saying "this adjustment below is not needed in the next arm"? If so, I think it'd be helpful to start with an explanation of what this if
is actually doing. (Ideally, including a Rust example)
r=me once we improve that comment =) |
9ce604e
to
9309e2e
Compare
2829dd6
to
7f7fada
Compare
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.
r=me
@bors r+ |
📌 Commit 7f7fada has been approved by |
⌛ Testing commit 7f7fada with merge f97935696d45572f456a8a06bce14b6f791654c6... |
💔 Test failed - status-travis |
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 |
Use smaller span for adjustments on block expressions When returning a mutable reference don't use the entire body of the function as the span for the adjustments at the end. The error [in this case](https://github.com/rust-lang/rust/compare/master...matthewjasper:hair-spans?expand=1#diff-ecef8b1f15622fb48a803c9b61605c78) is worse, but neither error message is really what we want. I have some ideas on how to get a better error message that will have to wait for a future PR.
☀️ Test successful - status-appveyor, status-travis |
When returning a mutable reference don't use the entire body of the function as the span for the adjustments at the end.
The error in this case is worse, but neither error message is really what we want. I have some ideas on how to get a better error message that will have to wait for a future PR.