Skip to content

Improve error message when someone triggers E0507 because of an invisible borrow due to implicit use of Deref trait #45515

Closed
@coriolinus

Description

@coriolinus

I recently hit a bug in which I wrote a function containing only owned data, but which produced a "cannot move out of borrowed content" compiler error. I only figured it out after building a minimal example.

I'd like to improve the error message, at least to the point where if an E0507 is triggered and there's a use of the Deref trait in the immediate context, that will be pointed out as a possible cause. I'm willing to put in the work to implement this myself, but I have zero compiler experience; mentorship would be extremely helpful.

Is this considered a "feature introduction" which would need an RFC, or should I just start working on a PR? If the latter, where in the codebase should I start looking in order to handle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions