Skip to content

Can't cast self to trait object in default methods #7320

Closed
@Blei

Description

@Blei

The following code doesn't work (even though I suspect it's correct):

trait Foo {
    fn foo(@self) { bar(self); }
}

fn bar(_b: @Foo) { }

The following error is returned:

<anon>:2:24: 2:29 error: mismatched types: expected `@Foo` but found `@Self` (expected trait Foo but found @-ptr)
<anon>:2     fn foo(@self) { bar(self); }
                                 ^~~~~
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions