KEMBAR78
"Rename Symbol" does not seem to work when #[derive(thiserror::Error)] · Issue #20332 · rust-lang/rust-analyzer · GitHub
Skip to content

"Rename Symbol" does not seem to work when #[derive(thiserror::Error)] #20332

@jhgg

Description

@jhgg

rust-analyzer version: rust-analyzer version: 0.4.2554-standalone (db02cdc 2025-07-27)

rustc version: rustc 1.89.0-nightly (99e7c15 2025-06-01)

editor or extension: VSCode

relevant settings:

cargo.toml dependency:

thiserror = "2.0.12"

code snippet to reproduce:

When trying to use "rename symbol" on FooError, vscode says "No references found at position"

#[derive(Debug, thiserror::Error)]
pub enum FooError {
    #[error("bar")]
    Bar,
    #[error("baz")]
    Baz,
}

temporarily removing thiserror::Error allows the symbol to be renamed.

incase it is useful, this is the expansion of the macro:

// Recursive expansion of thiserror::Error macro
// ==============================================

#[allow(unused_qualifications)]
#[automatically_derived]
impl ::thiserror::__private::Error for FooError {}

#[allow(unused_qualifications)]
#[automatically_derived]
impl ::core::fmt::Display for FooError {
    fn fmt(&self, __formatter: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        #[allow(unused_variables, deprecated, clippy::used_underscore_binding)]
        match self {
            FooError::Bar {} => __formatter.write_str("bar"),
            FooError::Baz {} => __formatter.write_str("baz"),
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions