Merge pull request #20333 from Veykril/push-xmulpqkxrytn

fix: Do not require all rename definitions to be renameable
This commit is contained in:
Lukas Wirth 2025-07-29 06:42:28 +00:00 committed by GitHub
commit 4bcc293637
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,13 +35,8 @@ pub(crate) fn prepare_rename(
let syntax = source_file.syntax(); let syntax = source_file.syntax();
let res = find_definitions(&sema, syntax, position, &Name::new_symbol_root(sym::underscore))? let res = find_definitions(&sema, syntax, position, &Name::new_symbol_root(sym::underscore))?
.map(|(frange, kind, def, _, _)| { .filter(|(_, _, def, _, _)| def.range_for_rename(&sema).is_some())
// ensure all ranges are valid .map(|(frange, kind, _, _, _)| {
if def.range_for_rename(&sema).is_none() {
bail!("No references found at position")
}
always!( always!(
frange.range.contains_inclusive(position.offset) frange.range.contains_inclusive(position.offset)
&& frange.file_id == position.file_id && frange.file_id == position.file_id