Skip to content

#![feature(arbitrary_self_types)] - "type of self must not be a method generic parameter type" #135429

Closed
@johamster

Description

@johamster

Up to version 1.83 the following code compiled successfully:

Code

#![feature(arbitrary_self_types)]                                                                                                                                                                                                                                 

struct Foo;
impl Foo {
    fn foo(self: &impl std::ops::Deref<Target = Self>) {}
}

With version 1.84 we get the following error:

error[E0801]: invalid generic `self` parameter type: `&impl std::ops::Deref<Target = Self>`
...
note: "type of `self` must not be a method generic parameter type"

Version it worked on

It most recently worked on: 1.83

Version with regression

rustc --version --verbose:

rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: aarch64-apple-darwin
release: 1.84.0
LLVM version: 19.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.F-arbitrary_self_types`#![feature(arbitrary_self_types)]`S-has-bisectionStatus: A bisection has been found for this issueT-langRelevant to the language 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