Skip to content

Conversation

@tysg
Copy link
Contributor

@tysg tysg commented Feb 9, 2022

Fixes #11417.

@tysg tysg force-pushed the rename-mod-in-macro branch from b407e78 to e62e926 Compare February 11, 2022 06:17
file_id,
TextEdit::replace(name.syntax().text_range(), new_name.to_string()),
),
_ => never!("Module source node is missing a name"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason the never! is gone now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back the never

Comment on lines 192 to 198
if let Some(file_range) = Definition::Module(module).range_for_rename(sema) {
source_change.insert_source_edit(
file_id,
TextEdit::replace(name.syntax().text_range(), new_name.to_string()),
),
_ => never!("Module source node is missing a name"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of calling out to range_for_rename we can just add the missing src.with_value(name.syntax()).original_file_range_opt(sema.db) line here instead since we already have the decl_source anyways

@Veykril
Copy link
Member

Veykril commented Feb 13, 2022

Thanks!
bors r+

@bors
Copy link
Contributor

bors bot commented Feb 13, 2022

@bors bors bot merged commit 59c49a9 into rust-lang:master Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

file/module rename mangles the starting text of the file declaring the module.

2 participants