mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Merge #8880
8880: fix: prepare_rename failing for modules r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Tobias Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
dc0f2c20f2
1 changed files with 7 additions and 5 deletions
|
@ -55,12 +55,14 @@ pub(crate) fn prepare_rename(
|
||||||
match def {
|
match def {
|
||||||
Definition::SelfType(_) => bail!("Cannot rename `Self`"),
|
Definition::SelfType(_) => bail!("Cannot rename `Self`"),
|
||||||
Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"),
|
Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"),
|
||||||
_ => {}
|
Definition::ModuleDef(ModuleDef::Module(_)) => (),
|
||||||
};
|
_ => {
|
||||||
let nav =
|
let nav = def
|
||||||
def.try_to_nav(sema.db).ok_or_else(|| format_err!("No references found at position"))?;
|
.try_to_nav(sema.db)
|
||||||
|
.ok_or_else(|| format_err!("No references found at position"))?;
|
||||||
nav.focus_range.ok_or_else(|| format_err!("No identifier available to rename"))?;
|
nav.focus_range.ok_or_else(|| format_err!("No identifier available to rename"))?;
|
||||||
|
}
|
||||||
|
};
|
||||||
let name_like = sema
|
let name_like = sema
|
||||||
.find_node_at_offset_with_descend(&syntax, position.offset)
|
.find_node_at_offset_with_descend(&syntax, position.offset)
|
||||||
.ok_or_else(|| format_err!("No references found at position"))?;
|
.ok_or_else(|| format_err!("No references found at position"))?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue