about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <me@lukaswirth.dev>2025-07-29 06:42:28 +0000
committerGitHub <noreply@github.com>2025-07-29 06:42:28 +0000
commite45400afb83a3508707f67219b37457c847e61e2 (patch)
tree7ec4dd48cd7b1111ecd4a76a64c5c074d631c597
parentb4b9f3e55506c566de9f96d869e5c42e09b88d20 (diff)
parent8b214fbf17d4e6f8e3ba38a26cffd741ac53adb8 (diff)
downloadrust-e45400afb83a3508707f67219b37457c847e61e2.tar.gz
rust-e45400afb83a3508707f67219b37457c847e61e2.zip
Merge pull request #20333 from Veykril/push-xmulpqkxrytn
fix: Do not require all rename definitions to be renameable
-rw-r--r--src/tools/rust-analyzer/crates/ide/src/rename.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/rename.rs b/src/tools/rust-analyzer/crates/ide/src/rename.rs
index a07c647c2cb..6c1d142c3b0 100644
--- a/src/tools/rust-analyzer/crates/ide/src/rename.rs
+++ b/src/tools/rust-analyzer/crates/ide/src/rename.rs
@@ -35,13 +35,8 @@ pub(crate) fn prepare_rename(
     let syntax = source_file.syntax();
 
     let res = find_definitions(&sema, syntax, position, &Name::new_symbol_root(sym::underscore))?
-        .map(|(frange, kind, def, _, _)| {
-            // ensure all ranges are valid
-
-            if def.range_for_rename(&sema).is_none() {
-                bail!("No references found at position")
-            }
-
+        .filter(|(_, _, def, _, _)| def.range_for_rename(&sema).is_some())
+        .map(|(frange, kind, _, _, _)| {
             always!(
                 frange.range.contains_inclusive(position.offset)
                     && frange.file_id == position.file_id