diff --git a/.vscode/settings.json b/.vscode/settings.json index 23d87c873a..cd6b17cad5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,6 @@ "rust-analyzer.check.command": "clippy", "rust-analyzer.check.features": "all", "rust-analyzer.rustfmt.extraArgs": ["+nightly"], - "rust-analyzer.server.path": "${workspaceFolder}/bin/rust-analyzer", "search.exclude": { // Packages and Dependencies "**/.hermit/": true, diff --git a/Cargo.toml b/Cargo.toml index ac80005268..c28cc77878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace.package] version = "0.11.0" -rust-version = "1.72.0" # Keep this version in sync with "$RUST_VERSION" in "$REPO_ROOT/bin/hermit.hcl" and "rust-src" in "$REPO_ROOT/bin" +rust-version = "1.72.0" # Keep this version in sync with "$RUST_STABLE_VERSION" in "$REPO_ROOT/bin/hermit.hcl" edition = "2021" publish = false diff --git a/bin/.rust-analyzer@latest.pkg b/bin/.rust-analyzer@latest.pkg deleted file mode 120000 index 383f4511d4..0000000000 --- a/bin/.rust-analyzer@latest.pkg +++ /dev/null @@ -1 +0,0 @@ -hermit \ No newline at end of file diff --git a/bin/.rust-src-1.72.0.pkg b/bin/.rust-src-1.72.0.pkg deleted file mode 120000 index 383f4511d4..0000000000 --- a/bin/.rust-src-1.72.0.pkg +++ /dev/null @@ -1 +0,0 @@ -hermit \ No newline at end of file diff --git a/bin/hermit.hcl b/bin/hermit.hcl index 23366acf10..95e0859e5c 100644 --- a/bin/hermit.hcl +++ b/bin/hermit.hcl @@ -9,7 +9,8 @@ env = { // Rust: "RUST_BACKTRACE": "FULL", - "RUST_VERSION": "1.72.0", // Keep this version in sync with "rust-version" in "$REPO_ROOT/Cargo.toml" and "rust-src" in "$REPO_ROOT/bin" + "RUST_STABLE_VERSION": "1.72.0", // Keep this version in sync with "rust-version" in "$REPO_ROOT/Cargo.toml" + "RUST_NIGHTLY_VERSION": "nightly-2023-12-01", "RUSTC_WRAPPER": "${HERMIT_ENV}/bin/sccache", "SCCACHE_DIR": "${HERMIT_ENV}/.hermit/sccache", diff --git a/bin/rust-analyzer b/bin/rust-analyzer deleted file mode 120000 index 105766ab16..0000000000 --- a/bin/rust-analyzer +++ /dev/null @@ -1 +0,0 @@ -.rust-analyzer@latest.pkg \ No newline at end of file diff --git a/bin/rust-src b/bin/rust-src deleted file mode 120000 index 60bf9b4607..0000000000 --- a/bin/rust-src +++ /dev/null @@ -1 +0,0 @@ -.rust-src-1.72.0.pkg \ No newline at end of file diff --git a/crates/infra/cli/src/commands/setup/cargo/mod.rs b/crates/infra/cli/src/commands/setup/cargo/mod.rs index 5437398137..f3e4aca5fa 100644 --- a/crates/infra/cli/src/commands/setup/cargo/mod.rs +++ b/crates/infra/cli/src/commands/setup/cargo/mod.rs @@ -3,7 +3,7 @@ use infra_utils::{commands::Command, github::GitHub}; pub fn setup_cargo() -> Result<()> { // The bootstrap bash script defined in '$REPO_ROOT/scripts/_common.sh' - // installs the 'minimal' profile of the '$RUST_VERSION' toolchain. + // installs the 'minimal' profile of the '$RUST_STABLE_VERSION' toolchain. // This includes the following components: // // - 'cargo' @@ -14,28 +14,23 @@ pub fn setup_cargo() -> Result<()> { // But we need these additional optional components: // // - 'clippy' for linting - // - 'rust-docs' for local development only + // - 'rust-docs' and 'rust-src' for local development // // So let's install these here: - rustup_add_component(env!("RUST_VERSION"), "clippy")?; + rustup_add_component(env!("RUST_STABLE_VERSION"), "clippy")?; if !GitHub::is_running_in_ci() { - rustup_add_component(env!("RUST_VERSION"), "rust-docs")?; + rustup_add_component(env!("RUST_STABLE_VERSION"), "rust-docs")?; + rustup_add_component(env!("RUST_STABLE_VERSION"), "rust-src")?; } // Additionally, we also need 'rustfmt nightly', as we use experimental options. - // So let's install the 'nightly' toolchain along with the 'rustfmt' component. + // So let's install the '$RUST_NIGHTLY_VERSION' toolchain along with the 'rustfmt' component. - rustup_install_toolchain("nightly")?; + rustup_install_toolchain(env!("RUST_NIGHTLY_VERSION"))?; - rustup_add_component("nightly", "rustfmt")?; - - // Warm up IDE tools if running locally. - - if !GitHub::is_running_in_ci() { - warm_up_ide_tools()?; - } + rustup_add_component(env!("RUST_NIGHTLY_VERSION"), "rustfmt")?; // Make sure we have the latest dependencies: @@ -50,7 +45,6 @@ fn rustup_install_toolchain(toolchain: &str) -> Result<()> { .flag("--no-self-update") .property("--profile", "minimal") .arg(toolchain) - .arg("nightly") .run() } @@ -62,14 +56,6 @@ fn rustup_add_component(toolchain: &str, component: &str) -> Result<()> { .run() } -fn warm_up_ide_tools() -> Result<()> { - Command::new("rust-analyzer").flag("--version").run()?; - - Command::new("rust-src").flag("--version").run()?; - - Ok(()) -} - fn run_cargo_fetch() -> Result<()> { let mut command = Command::new("cargo").arg("fetch"); diff --git a/scripts/_common.sh b/scripts/_common.sh index 9cb67a9d3b..38e8eb442d 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,7 +26,7 @@ set -euo pipefail } # -# This installs the minimal profile of the '$RUST_VERSION' toolchain. +# This installs the minimal profile of the '$RUST_STABLE_VERSION' toolchain. # Any additional toolchains, or optional components, should be installed # during 'infra setup cargo' step instead of here, as this is the hot path # for every other command. @@ -36,7 +36,7 @@ set -euo pipefail # { - rustup install --no-self-update --profile "minimal" "${RUST_VERSION:?}" + rustup install --no-self-update --profile "minimal" "${RUST_STABLE_VERSION:?}" - rustup default "${RUST_VERSION:?}" + rustup default "${RUST_STABLE_VERSION:?}" }