Skip to content

Unexpected &mut Self::XXX in completion list #20361

@A4-Tacks

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 1.90.0-nightly (9748d87 2025-07-21)

rustc version: rustc 1.90.0-nightly (9748d87dc 2025-07-21)

editor or extension: VIM-9.1

code snippet to reproduce:

enum State {
    Stop(()),
}

impl State {
    fn get_or_init(&mut self) -> &mut () {
        match self {
            State::Stop(_) => {
                let this = self;
                let Self::Stop(f) = this else { unreachable!() };
                *self = ;
            },
        }
    }
}

Image

Why does dereference assign suggest &mut ?

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