Skip to content

You can never call your own fn borrow(&mut self, ...) method if you use std::borrow::Borrow; #54103

@bombless

Description

@bombless

https://play.rust-lang.org/?gist=c36d8c617e66862b7bcaee05752ad313&version=stable&mode=debug&edition=2015

fn main() {
    use std::borrow::Borrow;
    struct S;
    impl S { fn borrow(&mut self, _: ()) {} }
    let mut s = S;
    s.borrow(())
}

(Just noticed that this might be the intended behaviour, since std::clone::Clone acts the same. But still, the error message here might need to be improved)

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`A-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.P-lowLow priorityT-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