You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggested rust-analyzer config can't run rustfmt #107547
I don't think we can put the binary back, or at least, that feels iffy - we'd be trying to overlap two different sysroots. rustfmt used to be statically linked to libstd and librustc_driver, but that's no longer the case.
On Windows, creating a symlink does not find the needed DLLs. Trying to execute the symlink pops two msgbox saying that it doesn't find the rustc_driver and std DLLs. You would need to symlink also the DLLs. On Linux, it does find the correct SOs.
Ok, this is pretty messy. How about doing both:
Add the symlink, which will work with both the old and new config on Mac and Linux
Update the recommended config in the dev-guide, which will help contributors fix the error message on Windows
and from there we can work long-term to using the same toolchain for rustfmt and other tools, without having a time pressure.
May I get some guidance and the creation of the symlink? Do I use rust to create the symlink in src/bootstrap/download.rs after the rustfmt_path line or do I use a bash command? If I do use a bash command, is there a file I should be adding it to?
I think it would be possible to move rustfmt back to the same sysroot as the bootstrap compiler by only taking libstd.so, librustc_middle.so and libLLVM.so from the nightly rustc component and not copying any other files like the rustc binary. Libstd.so and librustc_middle.so both contain a hash in their name unique for each rustc version. libLLVM.so should contain the rustc version, so that shouldn't conflict either.
Activity
zephaniahong commentedon Feb 1, 2023
@rustbot claim
zephaniahong commentedon Feb 1, 2023
Hi! Just to clarify, the idea is to change to code to match the docs?
albertlarsan68 commentedon Feb 1, 2023
I think the idea is changing the docs to match the new behavior.
zephaniahong commentedon Feb 1, 2023
For reference: rust-lang/rustc-dev-guide#1574
jyn514 commentedon Feb 1, 2023
I'd prefer to change the code so that we don't force all contributors to update their config.
Mark-Simulacrum commentedon Feb 1, 2023
I don't think we can put the binary back, or at least, that feels iffy - we'd be trying to overlap two different sysroots. rustfmt used to be statically linked to libstd and librustc_driver, but that's no longer the case.
Mark-Simulacrum commentedon Feb 1, 2023
I suppose we could try to create a symlink from the old path to the new one? That might work, not sure.
albertlarsan68 commentedon Feb 1, 2023
Maybe add a proxy?
On Linux it might just be
jyn514 commentedon Feb 1, 2023
A symlink seems like a good solution to me.
albertlarsan68 commentedon Feb 1, 2023
Does the symlink still finds the correct so?
3 remaining items
kadiwa4 commentedon Feb 1, 2023
Symlinking also works on macOS.
jyn514 commentedon Feb 2, 2023
Ok, this is pretty messy. How about doing both:
and from there we can work long-term to using the same toolchain for rustfmt and other tools, without having a time pressure.
jyn514 commentedon Feb 2, 2023
cc rust-lang/rustfmt#4884, rust-lang/rustfmt#3900
zephaniahong commentedon Feb 2, 2023
May I get some guidance and the creation of the symlink? Do I use rust to create the symlink in
src/bootstrap/download.rsafter the rustfmt_path line or do I use a bash command? If I do use a bash command, is there a file I should be adding it to?Thank you!
jyn514 commentedon Feb 2, 2023
@zephaniahong use
rust/src/bootstrap/lib.rs
Line 1593 in 99529b0
zephaniahong commentedon Feb 2, 2023
And just to confirm, I use that symlink function here?
rust/src/bootstrap/download.rs
Lines 332 to 333 in 11d96b5
jyn514 commentedon Feb 2, 2023
yes
bjorn3 commentedon Feb 2, 2023
I think it would be possible to move rustfmt back to the same sysroot as the bootstrap compiler by only taking libstd.so, librustc_middle.so and libLLVM.so from the nightly rustc component and not copying any other files like the rustc binary. Libstd.so and librustc_middle.so both contain a hash in their name unique for each rustc version. libLLVM.so should contain the rustc version, so that shouldn't conflict either.
albertlarsan68 commentedon Feb 2, 2023
Doing the same with the DLLs on Windows could also work.
est31 commentedon Feb 5, 2023
related (different error with rustfmt, but caused by the same change): #107676
jyn514 commentedon Feb 8, 2023
Hi @zephaniahong, any progress on the symlink? happy to help out if you're running into trouble :)
zephaniahong commentedon Feb 8, 2023
Hey @jyn514 ! Thanks for reaching out! I'll be starting tomorrow and will reach out to you if/when I need help!
Apologies for the delay!
Rollup merge of rust-lang#107834 - zephaniahong:issue-107547-fix, r=a…