Skip to content

"Reach into" Result/Option to look for expected methods in error messages #78374

Open
@qrnch-jan

Description

@qrnch-jan

Sometimes it would be really helpful if the compiler could "reach into" a Result or Option. Say one forgets to ? or even .unwrap(), the compiler currently says something like "no method named get_ref found for enum std::result::Result<tokio_rustls::client::TlsStream<tokio::net::TcpStream>, std::io::Error> in the current scope". It would be helpful if it would say something along the line of ".. but contained type T contains the requested method".

@estebank

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-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.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