Skip to content

Something's broken in sized/unsized traits #20550

Closed
@stepancheg

Description

@stepancheg

Code:

fn bar(foo: &Foo) {}

fn baz(foo: &Foo) {
    // this call works
    bar(foo);
}

trait Foo {
    fn qux(&self) {
        // this doesn't, and error is
        // error: the trait `core::kinds::Sized` is not implemented for the type `Self`
        bar(self);
    }
} 

Calls to bar seems to be identical from baz and qux functions, however, first call works and second doesn't. I don't understand how sized/unsized types work, please, close if it is not a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions