Skip to content

enabled a lens config CodeAction is very slow #17950

Open
@A4-Tacks

Description

@A4-Tacks

rust-analyzer version: rust-analyzer 1.82.0-nightly (7c2012d0 2024-07-26)

rustc version: rustc 1.82.0-nightly (7c2012d0e 2024-07-26)

editor or extension: Vim 9.1 coc-rust-analyzer

relevant settings:

{
    "rust-analyzer.updates.checkOnStartup": false,
    "rust-analyzer.lens.references.method.enable": true
}

code snippet to reproduce src/main.rs:

use std::{fmt::Display, ops::Deref};

#[derive(Debug, Clone, Eq)]
pub enum ParseLine<'a> {
    Label(&'a str),
    Args((), u32),
}
impl<'a> PartialEq for ParseLine<'a> {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (Self::Label(l0), Self::Label(r0)) => l0 == r0,
            (Self::Args(l0, _), Self::Args(r0, _)) => l0 == r0,
            _ => false,
        }
    }
}
impl<'a> TryFrom<Vec<&'a str>> for ParseLine<'a> {
    type Error = ();

    fn try_from(_: Vec<&'a str>) -> Result<Self, Self::Error> {
        Ok(Self::Args((), 0))
    }
}
impl<'a> From<&'a str> for ParseLine<'a> {
    fn from(_: &'a str) -> Self {
        todo!()
    }
}
impl<'a> From<()> for ParseLine<'a> {
    fn from(_: ()) -> Self {
        todo!()
    }
}
impl<'a> Display for ParseLine<'a> {
    fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        todo!()
    }
}


fn main() { }

reproduce steps:

  1. open file src/main.rs, CPU Usage to 400%, Memory Usage to 851 MB
  2. in line 11 => l0 start CodeAction, is slow
  3. any edit and save file, and start CodeAction is very slow, Max CPU Usage to 700%, Memory Usage to 1350 MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-perfperformance issuesC-supportCategory: support questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions