Skip to content
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

Suggest adding feature when a function / method / module defined behind such feature and it's not enabled #66034

Closed
upsuper opened this issue Nov 1, 2019 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@upsuper
Copy link
Contributor

upsuper commented Nov 1, 2019

When I was trying to migrate my crate to reqwest 0.10, there is a confusing compile error stating

error[E0599]: no method named json found for type reqwest::async_impl::request::RequestBuilder in the current scope

I had a brief look at the doc and could still find it. I eventually realized that it requires an additional feature json (as the doc correctly points out but overlooked by me).

I believe the compiler should have enough information about functions / method / module which are defined behind a feature, so it can probably step in and suggest such feature for this kind of errors so that people don't need to check code or even Cargo.toml of the crate to know what to do.

@upsuper upsuper changed the title Suggest adding feature when a function / method / module defined behind such feature cannot be used Suggest adding feature when a function / method / module defined behind such feature and it's not enabled Nov 1, 2019
@csmoe csmoe added A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Nov 2, 2019
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 4, 2019
@estebank estebank added the D-papercut Diagnostics: An error or lint that needs small tweaks. label Jan 8, 2020
@JohnTitor JohnTitor added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jan 12, 2020
@estebank
Copy link
Contributor

Fixed by #109005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants