Introduce a new CrateOrigin variant Member
#16174
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
calledMember
( 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... ) andCrateOrigin::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 ifCrateOrigin
isLocal
orMember
)". 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 haveCrateOrigin::Local
thus enabling renaming. So maybe hiding renaming behind a configuration may not be necessary after all