Skip to content

Can't find impl for type involving & #5050

Closed
@jdm

Description

@jdm
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions