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

Feature request: force use of a specific toolchain #18585

Closed
RalfJung opened this issue Dec 1, 2024 · 2 comments
Closed

Feature request: force use of a specific toolchain #18585

RalfJung opened this issue Dec 1, 2024 · 2 comments

Comments

@RalfJung
Copy link
Member

RalfJung commented Dec 1, 2024

When using RA in the rustc repo, a problem comes up when one adds compiler/rustc_codegen_cranelift/Cargo.toml to the linkedProjects: that folder contains a rust-toolchain file, and RA honors that file and then fails to load since I don't have that toolchain installed. It doesn't make a ton of sense for that one folder to use a different toolchain than the rest of the rustc workspace, so I'd like to avoid having to install even more different nightly versions of Rust, and just force the use of the nightly toolchain for everything. Would be nice if there was a setting for that. :)

@ChayimFriedman2
Copy link
Contributor

I think you can do that by setting "rust-analyzer.server.extraEnv": { "RUSTUP_TOOLCHAIN": "nightly" }.

@RalfJung
Copy link
Member Author

RalfJung commented Dec 1, 2024

Yes that seems to work, amazing -- thanks. :-)

@RalfJung RalfJung closed this as completed Dec 1, 2024
jhpratt added a commit to jhpratt/rust that referenced this issue Dec 2, 2024
…=jieyouxu

rust_analyzer_settings: force use of 'nightly' toolchain

The cranelift folder contains a rust-toolchain file. That means when RA opens `compiler/rustc_codegen_cranelift/Cargo.toml`, it will try to use that toolchain or fail. (Maybe that toolchain gets auto-installed for others? On my system, it just fails, but I also run vscodium in a sandbox.)

However, it shouldn't be necessary to use more than one toolchain for the rustc workspace. So we can set the `RUSTUP_TOOLCHAIN` variable on the server side to force the same toolchain to be used everywhere.

Suggested by `@ChayimFriedman2` in rust-lang/rust-analyzer#18585.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 2, 2024
Rollup merge of rust-lang#133712 - RalfJung:rust_analyzer_settings, r=jieyouxu

rust_analyzer_settings: force use of 'nightly' toolchain

The cranelift folder contains a rust-toolchain file. That means when RA opens `compiler/rustc_codegen_cranelift/Cargo.toml`, it will try to use that toolchain or fail. (Maybe that toolchain gets auto-installed for others? On my system, it just fails, but I also run vscodium in a sandbox.)

However, it shouldn't be necessary to use more than one toolchain for the rustc workspace. So we can set the `RUSTUP_TOOLCHAIN` variable on the server side to force the same toolchain to be used everywhere.

Suggested by `@ChayimFriedman2` in rust-lang/rust-analyzer#18585.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants