From e194f2edc4275f592c247e26a460b025c69c6cea Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 3 Mar 2021 19:48:53 +0100 Subject: Prevent renaming SelfType and BuiltinType --- crates/ide/src/references/rename.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'crates') diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 878ca1afc..1919639a3 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs @@ -88,6 +88,8 @@ pub(crate) fn rename_with_semantics( let def = find_definition(sema, syntax, position)?; match def { Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(&sema, module, new_name), + Definition::SelfType(_) => bail!("Cannot rename `Self`"), + Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"), def => rename_reference(sema, def, new_name), } } -- cgit v1.2.3