Skip to content

feat: Warn the user when a rename will change the meaning of the program #19079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

ChayimFriedman2
Copy link
Contributor

Specifically, when a rename of a local will change some code that refers it to refer another local, or some code that refer another local to refer to it.

We do it by introducing a dummy edit with an annotation. I'm not a fond of this approach, but I don't think LSP has a better way.

Demo:

Screen.Recording.2025-02-02.015127.mp4

Closes #10713.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 1, 2025
@ChayimFriedman2
Copy link
Contributor Author

Okay I removed the dummy edit.

@BenjaminBrienen
Copy link
Contributor

I ran into this earlier where a rename caused a compilation error. Not super confusing to deal with, but this would be a cool feature.

Specifically, when a rename of a local will change some code that refers it to refer another local, or some code that refer another local to refer to it.

We do it by introducing a dummy edit with an annotation. I'm not a fond of this approach, but I don't think LSP has a better way.
@Veykril Veykril added this pull request to the merge queue Mar 10, 2025
Merged via the queue into rust-lang:master with commit cf255a6 Mar 10, 2025
9 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the rename-conflict branch March 10, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renames are allowed to change the meaning of the program, due to shadowing.
4 participants