Skip to content

Traits not checking for Self: Sized on required methods #134422

Closed as not planned
Closed as not planned
@ionicmc-rs

Description

@ionicmc-rs

I tried this code:

trait MyTrait {
    fn foo(self);
}

I expected to see this happen:

Error: the size for values of type 'Self' do not have a know size at compile time
# ...

Instead, this happened:

# No Errors

Meta

rustc --version --verbose:

rustc 1.85.0-nightly (21fe748be 2024-12-11)
binary: rustc
commit-hash: 21fe748be15271ea5804e0507cd699b675efe038
commit-date: 2024-12-11
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Backtrace

# None, because it does not throw an error, which is kinda the problem

The only reason i think this is here is to allow for dyn compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-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