aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-03-03 18:48:53 +0000
committerLukas Wirth <[email protected]>2021-03-03 18:48:53 +0000
commite194f2edc4275f592c247e26a460b025c69c6cea (patch)
treed689a935db88e219dcdedfc77b00680c3d87e503
parent183ba483a93fa8968ffbd5828c5e4c2684f0094c (diff)
Prevent renaming SelfType and BuiltinType
-rw-r--r--crates/ide/src/references/rename.rs2
1 files changed, 2 insertions, 0 deletions
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(
88 let def = find_definition(sema, syntax, position)?; 88 let def = find_definition(sema, syntax, position)?;
89 match def { 89 match def {
90 Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(&sema, module, new_name), 90 Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(&sema, module, new_name),
91 Definition::SelfType(_) => bail!("Cannot rename `Self`"),
92 Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"),
91 def => rename_reference(sema, def, new_name), 93 def => rename_reference(sema, def, new_name),
92 } 94 }
93} 95}