Skip to content
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

Introduce a new CrateOrigin variant Member #16174

Closed

Conversation

alibektas
Copy link
Member

CrateGraph has been suffering from ignoring a unified definition of a Workspace : Cargo rightly assumes that each project has its own workspace but in RA this assumption does not hold and this has caused problems for renaming symbols ( #15656 ). What I propose is to add a new variant to CrateOrigin called Member ( the name is open to discussion :D ). Member will be assigned to workspace members and this is easy to find out as cargo provides this information directly. CrateOrigin::Local will now be those crates that workspaces depend on and these crates need to be in the local filesystem and open to editing ( current state of things doesn't really reflect what I describe but anyway... ) and CrateOrigin::Library will be the vendor crates. By doing this we can now express things like "a symbol is renameable if it originates from a user defined crate ( meaning if CrateOrigin is Local or Member)". This follows in part @ogapo's findings so let's thank them too!

This also mitigates the issue we had here by making all the proc-macro enabled crates have CrateOrigin::Local thus enabling renaming. So maybe hiding renaming behind a configuration may not be necessary after all

CrateGraph has been suffering from ignoring a unified definition of a Workspace : Cargo
rightly assumes that each project has its own workspace but in RA this assumption does not
hold and this has caused problems for renaming symbols ( rust-lang#15656 ). What I propose is to add
a new variant to `CrateOrigin` called `Member` ( the name is open to discussion :D ). Member will be assigned
to workspace members and this is easy to find out as cargo provides this information directly. `CrateOrigin::Local`
will now be those crates that workspaces depend on and these crates need to be in the local filesystem and open to editing ( current state of things doesn't
really reflect what I describe but anyway... ) and `CrateOrigin::Library` will be the *vendor* crates.
By doing this we can now express things like "a symbol is renameable if it originates from a user defined crate ( meaning if `CrateOrigin` is `Local` or `Member`)".
This follows in part @ogapo's findings so let's thank them too!
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 21, 2023
@flodiebold
Copy link
Member

As mentioned in #15656, this doesn't seem the right approach for determining "can we rename a symbol" to me 🤔

@alibektas
Copy link
Member Author

Maybe you are seeing sth that I can't. Do you mind sharing your intuitions?

@alibektas
Copy link
Member Author

Ok I am closing this issue as I see now @flodiebold's point after a discussion with @Veykril.

@alibektas alibektas closed this Dec 21, 2023
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.

3 participants