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

Idea: run migration scripts on cargo upgrade #410

Open
ordian opened this issue Jul 7, 2020 · 3 comments
Open

Idea: run migration scripts on cargo upgrade #410

ordian opened this issue Jul 7, 2020 · 3 comments

Comments

@ordian
Copy link
Collaborator

ordian commented Jul 7, 2020

This may be out of scope of cargo-edit, but my writing this down not to forget it.
The idea is that when library authors make a breaking change, they also write a script e.g. in ra_ssr that does the migration for your code wherever possible.

Then cargo-upgrade would pull these migration scripts (assuming some convention for a standard location) and run them.
Imagine a world where even a major upgrade e.g. from tokio 0.2 to tokio 0.3 can be done with a single cargo upgrade :)

@matklad
Copy link

matklad commented Jul 8, 2020

@ordian
Copy link
Collaborator Author

ordian commented Jul 9, 2020

@matklad thanks for the reply. If I understand correctly, an attribute is only capable of replacing invocation of one function with a code snippet, whereas scripts are more flexible and allow you to specify e.g. if you pass this parameter then use that instead or if you're calling this function inside of that function, here is a migration script for you. But to be fair, this is all speculative ATM.

@matklad
Copy link

matklad commented Jul 9, 2020

Yup, attrs are indeed restricted, but my gut feeling is that they should cover 80 of automatable migrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants