Skip to content

Can't find impl for type involving & #5050

Closed

Description

rusti> trait Tr { fn foo(&self); }
()
rusti>  impl Tr for &int { fn foo(&self) {} }
()
rusti> fn foo<T: Tr>(a: &T) { a.foo(); }
()
rusti> foo(&5);
<anon>:45:0: 45:3 error: failed to find an implementation of trait @main::Tr for <V1>

There are similarly confusing errors involving unsafe pointers, but I haven't figured out a good testcase yet.

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

Metadata

Assignees

No one assigned

    Labels

    A-traitsArea: Trait system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions