Skip to content

Type mismatch method suggestion doesn't work for as_deref #80508

Closed
@jplatte

Description

@jplatte

It would be really nice if the mismatched type diagnostic would work for as_deref. Currently, trying to use Option<Vec<String>> where Option<&[String]> is expected doesn't give a method call suggestion the way one gets a suggestion to borrow when trying to use Vec<String> where &[String] is expected.

   = note: expected enum `std::option::Option<&[std::string::String]>`
              found enum `std::option::Option<Vec<std::string::String>>`

^ no suggestion

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-result-optionArea: Result and Option combinatorsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.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

    Issue actions