Stream: t-compiler/rust-analyzer

Topic: Standalone SSR


David Barsky (Sep 23 2020 at 15:26, on Zulip):

I wanted check on the feasibility of using rust-analyzer's SSR functionality as a standalone cargo fix-style refactoring tool for breaking changes in crates. is that feasible/a good idea at this time?

Laurențiu (Sep 23 2020 at 15:27, on Zulip):

I think @pksunkara was also interested in that, for porting code to clap 3.

David Barsky (Sep 23 2020 at 15:28, on Zulip):

gotcha. I know that portions of rust-analyzer are published to crates.io, but i'm not sure if _this_ portion is.

pksunkara (Sep 23 2020 at 15:54, on Zulip):

Thanks for the mention @Laurențiu Nicola

@David Barsky I have a minimum viable code at https://github.com/pksunkara/cargo-up. And the related code that describes the breaking changes is at https://github.com/clap-rs/clap/blob/master/clap_up/src/lib.rs. We can have a call if you are interested in working on this.

pksunkara (Sep 23 2020 at 15:55, on Zulip):

In fact, I was the one who did the work to publish rust-analyzer on crates.io so that I can use those deps in this tool.

David Barsky (Sep 23 2020 at 15:59, on Zulip):

Thanks for offer for the call, but I think I'm good for now. what sort of work is remaining on this thing?

David Barsky (Sep 23 2020 at 16:21, on Zulip):

ah, my response was to an incorrect read of a now-edited comment. nevermind!

pksunkara (Sep 23 2020 at 18:15, on Zulip):

As I said, there's almost nothing else needed from rust-analyzer side. The only main thing left to do in the tool is https://github.com/pksunkara/cargo-up/blob/541e7b0e83dbb733e29ae4980c1b6fd7a7b6bc21/cargo-up/src/cli/dep.rs#L88.

pksunkara (Sep 23 2020 at 18:16, on Zulip):

Everything else can be added later. I am slowly trying to get it working for clap 3.0 release, so that all people have to do is cargo up dep clap. And then we can try to add more features once people start to use it for their deps too

matklad (Sep 24 2020 at 08:32, on Zulip):

I think we already expose this as a CLI?

λ rust-analyzer --help ^| tail -n 8
ssr [RULE...]
    <RULE>            A structured search replace rule (`$a.foo($b) ==> bar($a, $b)`)

search [PATTERN..]
    <PATTERN>         A structured search replace pattern (`$a.foo($b)`)
    --debug <snippet> Prints debug information for any nodes with source exactly
                      equal to <snippet>
Last update: Jul 27 2021 at 22:30UTC