Skip to content

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

Closed
@upsuper

Description

@upsuper
Contributor

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.

Activity

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[/+] on Nov 1, 2019
added
A-diagnosticsArea: Messages for errors, warnings, and lints
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`
on Nov 2, 2019
added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Nov 4, 2019
added
D-papercutDiagnostics: An error or lint that needs small tweaks.
on Jan 8, 2020
added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Jan 12, 2020
estebank

estebank commented on Jun 29, 2023

@estebank
Contributor

Fixed by #109005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @upsuper@estebank@JohnTitor@csmoe

        Issue actions

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