-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
269 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,40 @@ | ||
# Rust | ||
|
||
Rust is not currently offered as a core plugin. In fact, I don't think you | ||
should actually use mise for rust development. Rust has an official version | ||
manager called [`rustup`](https://rustup.rs/) that is better than what any of | ||
the current mise plugins offer. | ||
Rust/cargo can be installed which uses rustup under the hood. mise will install rustup if it is not | ||
already installed and add the requested targets. By default, mise uses the default location of rustup/cargo | ||
(`~/.rustup` and `~/.cargo`), but you can change this by setting the `MISE_RUSTUP_HOME` and `MISE_CARGO_HOME` | ||
environment variables if you'd like to isolate mise's rustup/cargo from your other rustup/cargo installations. | ||
|
||
You install [rustup](https://rustup.rs/) with the following: | ||
Unlike most tools, these won't exist inside of `~/.local/share/mise/installs` because they are managed by rustup. | ||
All mise does is set the `RUST_TOOLCHAIN` environment variable to the requested version and rustup will | ||
automatically install it if it doesn't exist. | ||
|
||
```sh | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
``` | ||
|
||
That said, rust is still one of the most popular languages to use in mise. | ||
A lot of users have success with it so if you'd like to keep all of your | ||
languages configured the same, don't feel like using mise is a bad idea either. Especially if you're only a casual rust user. | ||
## Usage | ||
|
||
If you're a relatively heavy rust user making use of things like channel | ||
overrides, components, and cross-compiling, then I think you really should | ||
just be using rustup though. The experience will be better. | ||
Use the latest stable version of rust: | ||
|
||
If one day we could figure out a way to provide an equivalent experience with | ||
mise, we could revisit this. We have discussed potentially using mise as a | ||
"front-end" to rustup where there is one rustup install that mise just manages | ||
so you could do something like this: | ||
|
||
```toml | ||
[tools] | ||
rust = "nightly" | ||
```sh | ||
mise use -g rust | ||
cargo build | ||
``` | ||
|
||
Where that would basically be equivalent to: | ||
Use the latest beta version of rust: | ||
|
||
```sh | ||
rustup override set nightly | ||
mise use -g rust@beta | ||
cargo build | ||
``` | ||
|
||
Frankly though, this isn't high on my priority list. Use rustup. It's great. | ||
Use a specific version of rust: | ||
|
||
Kudos for writing rust too btw, I've really enjoyed it so far—this is my first rust project. | ||
|
||
## Default crates | ||
```sh | ||
mise use -g rust@1.82 | ||
cargo build | ||
``` | ||
|
||
mise can automatically install a default set of creates right after installing a new rust version. | ||
To enable this feature, provide a `$HOME/.default-cargo-crates` file that lists one crate per line, for | ||
example: | ||
## Settings | ||
|
||
```text | ||
cargo-edit | ||
stylua | ||
``` | ||
<script setup> | ||
import Settings from '/components/settings.vue'; | ||
</script> | ||
<Settings child="rust" :level="3" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
Describe 'node' { | ||
It 'executes rust 1.82.0' { | ||
mise x rust@1.82.0 -- rustc -V | Should -BeLike "rustc 1.82.0*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
export MISE_RUSTUP_HOME="$MISE_DATA_DIR/rustup" | ||
export MISE_CARGO_HOME="$MISE_DATA_DIR/cargo" | ||
|
||
assert_contains "mise x rust@1.82.0 -- rustc --version" "rustc 1.82.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.