fix: Add -Zjson-target-spec on Cargo calls where needed - #21846
Conversation
|
Yeah, the older versions without that flag will error with it. For the later, I guess we could just do it based on the toolchain version. Would that be hard because of some quirks in our codebase? (I can't check whether it's hard or not since I'm outside rn. Sry 😅 ) |
|
We already have the sysroot here so we should have the toolchain version queried already somewhere |
|
As Lukas said we should the toolchain version available there, I guess you could compare the toolchain version like the following lines: rust-analyzer/crates/project-model/src/cargo_config_file.rs Lines 171 to 173 in 803fb51 |
|
Hi @ChayimFriedman2, I've dropped #22435 in favour of this PR. Two notes that may help unstick it:
I'd be happy to push a commit to this branch that adds the metadata site and version gating if you'd like, or leave it for you. Either is fine. |
This comment has been minimized.
This comment has been minimized.
e4b165f to
dc50fc2
Compare
|
But feel free to re-assign. |
| has_json_target |= target.ends_with(".json"); | ||
| } | ||
| if has_json_target | ||
| && toolchain_version.is_some_and(|version| { |
There was a problem hiding this comment.
I'm a bit uncertain on whether we should make this default when the toolchain_version.is_none(), as it will fail when the toolchain is empty but actually 1.95.0 =<, like in flychecks with InvocationStrategy::Once.
But as you have written #23012 this would be okay
Fixes #21821.
CC @ShoyuVanilla assuming you know - do we need to gate this only for affected Cargo versions? If so, how?