-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest possible fix for missing library link #5729
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
So I've built a small test for this case, but I'm not entirely sure how to set it up for the test runner. The docs say that using The documentation on this matter is rather thin. At least any documentation I have found. Pointers to more relevant info would be welcome. |
I'm attempting to learn to write programs using Rust. One problem I encountered early on was errors about failed imports due to unre- solved names. The problem was I overlooked the need to declare the link to `std` before importing names into my module. I thought `rustc` could use a more helpful diagnostic message when it encounters this issue, so I went ahead and implemented a refer- ence fix. Hopefully the message will be useful to future Rust prog- rammers.
I cleaned up the history of this pull request, but it seems that comments are attached to the history as well -- which I wasn't aware was the case. So apologies for screwing up the comment history of this request. For future reference, is it acceptable to rewrite pull request history, or would it be preferred to close out a pull request and open a new one with the rewritten history? |
Rewritten is fine. |
Good idea |
Thanks. I wasn't sure if |
Will this suggest that people do |
I'm still new enough to rust that I need to ask if you could provide an example of such a case, I can certainly test it. |
Per @bstrie , this seems like it could invoke additional confusion. e.g. if you write
It will suggest you Also:
rustc will suggest you add
That of course doesn't work because If we're going to suggest |
Ok, I think this branch needs a little more work, but this seems like a useful idea so I opened #6379 on this subject. Closing for now. |
Add a cast to the suggestion when the return expression has adjustments. These adjustments are lost when the suggestion is applied. This is similar to the problem in issue rust-lang#4437. Closes rust-lang#5729
Fix `let_and_return` bad suggestion Add a cast to the suggestion when the return expression has adjustments. These adjustments are lost when the suggestion is applied. This is similar to the problem in issue rust-lang#4437. Closes rust-lang#5729 changelog: Fix `let_and_return` bad suggestion
I'm attempting to learn to write programs using Rust. One problem I encountered early on was errors about failed imports due to unresolved names. The problem was I overlooked the need to declare the link to
std
before importing names into my module.I thought
rustc
could use a more helpful diagnostic message when it encounters this issue, so I went ahead and implemented a reference fix. Hopefully the message will be useful to future Rust programmers.