Stream: t-compiler/rust-analyzer

Topic: runnables fix

Coenen Benjamin (May 07 2020 at 14:18, on Zulip):

Hey @matklad sorry to disturb you but I wanted to have your opinion about the fix for . In fact I know we don't have to add the bin runnableKind if we are in a lib runnableTarget. It seems pretty clear but I have 2 options to implement the fix. First is to filter here because we have access to cargo_spec at this location. Other solution is to pass a new argument to this function which would be the TargetKind to know if it's a lib we don't add binary target for main function. But it seems the second solution is better but I think it's a kind of antipattern for salsa to add this kind of argument instead of just keep the Id. And the first solution is a bit annoying because I have to filter at 2 different places: one for handler_runnables and one for handle_codelens. What do you think ?

Coenen Benjamin (May 07 2020 at 14:34, on Zulip):

And BTW for the second idea it will be an Option<TargetKind> and not just a TargetKind

matklad (May 07 2020 at 14:35, on Zulip):

I think it's better to filter out in handlers

Coenen Benjamin (May 07 2020 at 14:35, on Zulip):

Ok right, after trying to implement the second solution I think the same as you :p

matklad (May 07 2020 at 14:35, on Zulip):

In the ideal world, we should add crate_types field to crate graph, but we are not in an ideal world yet :D

Last update: Jul 24 2021 at 19:15UTC