From f2137c90ab878f2c7853d059b78e97f09004ad27 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:44:46 +0200 Subject: [PATCH] upgrade to rust 1.70.0 --- .github/workflows/windows_release_build.yml | 4 ++-- .github/workflows/windows_tests.yml | 4 ++-- Earthfile | 2 +- crates/compiler/build/src/link.rs | 2 +- crates/roc_std/tests/test_roc_std.rs | 3 ++- default.nix | 7 +++---- .../rust-platform/rust-toolchain.toml | 2 +- flake.lock | 14 +++++++------- flake.nix | 3 ++- rust-toolchain.toml | 5 +++-- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/windows_release_build.yml b/.github/workflows/windows_release_build.yml index 2845208955..fee39a873a 100644 --- a/.github/workflows/windows_release_build.yml +++ b/.github/workflows/windows_release_build.yml @@ -33,8 +33,8 @@ jobs: - name: zig version run: zig version - - name: install rust nightly 1.67 - run: rustup install nightly-2022-12-09 + - name: install rust nightly 1.70.0 + run: rustup install nightly-2023-04-15 - name: set up llvm 13 run: | diff --git a/.github/workflows/windows_tests.yml b/.github/workflows/windows_tests.yml index 3fce2a66cb..3c930d54b1 100644 --- a/.github/workflows/windows_tests.yml +++ b/.github/workflows/windows_tests.yml @@ -37,8 +37,8 @@ jobs: - name: zig version run: zig version - - name: install rust nightly 1.67 - run: rustup install nightly-2022-12-09 + - name: install rust nightly 1.70.0 + run: rustup install nightly-2023-04-15 - name: set up llvm 13 run: | diff --git a/Earthfile b/Earthfile index 90aa1b5d70..f94a859b60 100644 --- a/Earthfile +++ b/Earthfile @@ -1,6 +1,6 @@ VERSION 0.6 -FROM rust:1.67.1-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version +FROM rust:1.70.0-slim-buster # make sure to update rust-toolchain.toml too so that everything uses the same rust version WORKDIR /earthbuild prep-debian: diff --git a/crates/compiler/build/src/link.rs b/crates/compiler/build/src/link.rs index 519b88bca8..7676155840 100644 --- a/crates/compiler/build/src/link.rs +++ b/crates/compiler/build/src/link.rs @@ -530,7 +530,7 @@ pub fn rebuild_host( // on windows, we need the nightly toolchain so we can use `-Z export-executable-symbols` // using `+nightly` only works when running cargo through rustup let mut cmd = rustup(); - cmd.args(["run", "nightly-2022-12-09", "cargo"]); + cmd.args(["run", "nightly-2023-04-15", "cargo"]); cmd } else { diff --git a/crates/roc_std/tests/test_roc_std.rs b/crates/roc_std/tests/test_roc_std.rs index 6a41552c69..efedf472bb 100644 --- a/crates/roc_std/tests/test_roc_std.rs +++ b/crates/roc_std/tests/test_roc_std.rs @@ -1,4 +1,5 @@ -#![allow(clippy::missing_safety_doc)] +#![allow(clippy::missing_safety_doc, clippy::redundant_clone)] +// TODO try removing allow clippy::redundant_clone if we're on rust 1.71 or later #[macro_use] extern crate pretty_assertions; diff --git a/default.nix b/default.nix index c4839e99d5..fe59200244 100644 --- a/default.nix +++ b/default.nix @@ -8,10 +8,8 @@ }: # we only use this file to release a nix package, use flake.nix for development let - rustPlatform = pkgs.rustPlatform; - desiredRustVersion = (builtins.fromTOML (builtins.readFile (./rust-toolchain.toml))).toolchain.channel; - actualRustVersion = rustPlatform.rust.rustc; + actualRustVersion = pkgs.rustc; rustVersionsMatch = pkgs.lib.strings.hasSuffix desiredRustVersion actualRustVersion; llvmPkgs = pkgs.llvmPackages_13; @@ -28,9 +26,10 @@ in 5. Find the long SHA by executing `git rev-parse ` 6. Copy the long SHA 7. Paste it in place of the old SHA(rev) in flake.nix:inputs:nixpkgs.url + 8. execute `nix flake lock --update-input rust-overlay` ''; - rustPlatform.buildRustPackage { + pkgs.rustPlatform.buildRustPackage { pname = "roc"; version = "0.0.1"; diff --git a/examples/platform-switching/rust-platform/rust-toolchain.toml b/examples/platform-switching/rust-platform/rust-toolchain.toml index 9e80c03829..b4dd8635f0 100644 --- a/examples/platform-switching/rust-platform/rust-toolchain.toml +++ b/examples/platform-switching/rust-platform/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.67.1" +channel = "1.70.0" profile = "default" diff --git a/flake.lock b/flake.lock index e8b6934018..2601b3afa0 100644 --- a/flake.lock +++ b/flake.lock @@ -74,17 +74,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1679868513, - "narHash": "sha256-uRGLALUmieyMVqVt3mXEv0a+g9ouFOCmsv7V/01efEc=", + "lastModified": 1690279121, + "narHash": "sha256-XoPGhV1UJQPue6RiehAu7lQwKss3J1B/K0QtVOMD83A=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d7887373fe0731719365831cd254c1e5948307d3", + "rev": "821c72743ceae44bdd09718d47cab98fd5fd90af", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "d7887373fe0731719365831cd254c1e5948307d3", + "rev": "821c72743ceae44bdd09718d47cab98fd5fd90af", "type": "github" } }, @@ -104,11 +104,11 @@ ] }, "locked": { - "lastModified": 1682389182, - "narHash": "sha256-8t2nmFnH+8V48+IJsf8AK51ebXNlVbOSVYOpiqJKvJE=", + "lastModified": 1690252178, + "narHash": "sha256-9oEz822bvbHobfCUjJLDor2BqW3I5tycIauzDlzOALY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "74f1a64dd28faeeb85ef081f32cad2989850322c", + "rev": "8d64353ca827002fb8459e44d49116c78d868eba", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 224c01cb75..a8be3b40e1 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Roc flake"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs?rev=d7887373fe0731719365831cd254c1e5948307d3"; + nixpkgs.url = "github:nixos/nixpkgs?rev=821c72743ceae44bdd09718d47cab98fd5fd90af"; # rust from nixpkgs has some libc problems, this is patched in the rust-overlay rust-overlay = { @@ -112,6 +112,7 @@ aliases = '' alias clippy='cargo clippy --workspace --tests --release -- --deny warnings' alias fmt='cargo fmt --all' + alias fmtc='cargo fmt --all -- --check' ''; in { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 141eca0735..ebeae83c79 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -9,10 +9,11 @@ # - update nightly-OLD_DATE in .github/workflows/windows_tests.yml # - update nightly-OLD_DATE in .github/workflows/windows_release_build.yml # - update nightly-OLD_DATE in crates/compiler/build/src/link.rs +# - Follow instructions in default.nix: `assert pkgs.lib.assertMsg rustVersionsMatch` ... -channel = "1.67.1" # check ^^^ when changing this +channel = "1.70.0" # check ^^^ when changing this # -# channel = "nightly-2022-12-09" # 1.67.0 nightly to be able to use unstable features +# channel = "nightly-2023-04-15" # 1.70.0 nightly to be able to use unstable features profile = "default" components = [ # for usages of rust-analyzer or similar tools inside `nix develop`