-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Provide better borrow checker error message #48708
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
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Hey @estebank . This code has a lot of dog science in it (i.e. I had very little idea of what I'm doing). There are a few things I'm not sure on:
|
Your assumption was correct.
That sometimes happens, specially when working with very specific diagnostics. There are some things that can be done to reduce nesting, like the following: match (x, y) {
(Some(x), Some(y)) if x == y => { /* */ }
_ => {}
} instead of if let Some(x) = x {
if let Some(y) = y {
if x == y { /* */ }
}
}
match (x, y) {
(Some(x), Some(y)) if x == y => { /* */ }
_ => {}
} but that depends a lot on the code being written.
I'll take a look at it. Have to explore the code for it.
Create a file in |
Ping from the triage team @klnusbaum, and thanks for this PR! The reviewer left a few comments, could you address them so we can move forward with this? Also, your PR is failing a few tidy tests, but they should be really easy to fix :)
|
Hi @estebank I'll try to take a look at this in the next few days :) |
Do not hesitate to ping me here or in gitter, but I might be slow to answer depending on availability. Also, you have https://forge.rust-lang.org/x-py.html available in case you need a reference for the build tooling. |
started working on this again. Hope to have something new by the end of the weekend. |
125af62
to
33ff8fc
Compare
alright, I've actually got a test going now. I've restructured some of the code but I've run into an interesting compile error that I'm not sure how best to fix. Could I get some advice here? The error is:
|
Your PR failed on Travis. Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. 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 |
Ping from triage, @klnusbaum ! Are you still working on this?
In general, you have to reorganize the code. Sometimes you need to move the guard to a "normal" if statement inside the arm. |
Ping from triage @klnusbaum! We haven't heard from you in a while, are you still working on this? |
I've paused working on this for a bit (I'm trying to ramp up my Rust knowledge a little more). If this is urgent, someone else may want to take it over. |
Thanks for the PR @klnusbaum! Since there was no activity for more than two weeks on this, I'm closing the PR to keep things tidy. Don't worry though, if you'll have time to work on this again in the future please reopen the PR! We'll be happy to review it then! |
Fix for issue #45392
Given incorrect code like:
Rust suggests:
This isn't the best suggestion in this case. We should instead have a suggestion that informs the user they should change their code to look like: