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

refactor: Bump MSRV to 1.75 for async in trait #2203

Merged
merged 4 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: ci
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
lint:
Expand All @@ -9,8 +9,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
component: [clippy]
os: [ ubuntu-latest, macOS-latest, windows-latest ]
component: [ clippy ]
include:
- component: rustfmt
cargo_cmd: fmt -- --check
Expand All @@ -26,7 +26,7 @@ jobs:
with:
components: ${{ matrix.component }}
# Oldest supported version, keep in sync with README.md
toolchain: "1.70.0"
toolchain: "1.75.0"

- name: clippy version
run: cargo clippy --version
Expand All @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
feature: [azure, gcs, gha, memcached, redis, s3, webdav]
feature: [ azure, gcs, gha, memcached, redis, s3, webdav ]
steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -67,10 +67,10 @@ jobs:
include:
- os: ubuntu-20.04
# Oldest supported version, keep in sync with README.md
rustc: "1.70.0"
rustc: "1.75.0"
- os: ubuntu-22.04
# Oldest supported version, keep in sync with README.md
rustc: "1.70.0"
rustc: "1.75.0"
extra_desc: dist-server
extra_args: --no-default-features --features=dist-tests test_dist_ -- --test-threads 1
- os: ubuntu-20.04
Expand All @@ -91,7 +91,7 @@ jobs:
- os: macos-14
- os: windows-2019
# Oldest supported version, keep in sync with README.md
rustc: "1.70.0"
rustc: "1.75.0"
- os: windows-2019
rustc: nightly
allow_failure: true
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
release:
name: release
runs-on: ubuntu-latest
needs: [build, lint, test]
needs: [ build, lint, test ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "sccache"
rust-version = "1.70.0"
rust-version = "1.75.0"
version = "0.8.1"

categories = ["command-line-utilities", "development-tools::build-utils"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ And you can build code as usual without any additional flags in the command line
Build Requirements
------------------

sccache is a [Rust](https://www.rust-lang.org/) program. Building it requires `cargo` (and thus`rustc`). sccache currently requires **Rust 1.70.0**. We recommend you install Rust via [Rustup](https://rustup.rs/).
sccache is a [Rust](https://www.rust-lang.org/) program. Building it requires `cargo` (and thus`rustc`). sccache currently requires **Rust 1.75.0**. We recommend you install Rust via [Rustup](https://rustup.rs/).

Build
-----
Expand Down
74 changes: 37 additions & 37 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@ adopt-info: sccache

summary: sccache is ccache with cloud storage
description: |
sccache is a ccache-like compiler caching tool. It is used as a compiler
wrapper and avoids compilation when possible, storing cached results either
on local disk or in one of several cloud storage backends.

sccache includes support for caching the compilation of C/C++ code, Rust, as
well as NVIDIA's CUDA using nvcc.

sccache also provides icecream-style distributed compilation (automatic
packaging of local toolchains) for all supported compilers (including Rust).
The distributed compilation system includes several security features that
icecream lacks such as authentication, transport layer encryption, and
sandboxed compiler execution on build servers. See the distributed quickstart
guide for more information.

sccache is also available as a GitHub Actions to facilitate the deployment
using GitHub Actions cache.
sccache is a ccache-like compiler caching tool. It is used as a compiler
wrapper and avoids compilation when possible, storing cached results either
on local disk or in one of several cloud storage backends.
sccache includes support for caching the compilation of C/C++ code, Rust, as
well as NVIDIA's CUDA using nvcc.
sccache also provides icecream-style distributed compilation (automatic
packaging of local toolchains) for all supported compilers (including Rust).
The distributed compilation system includes several security features that
icecream lacks such as authentication, transport layer encryption, and
sandboxed compiler execution on build servers. See the distributed quickstart
guide for more information.
sccache is also available as a GitHub Actions to facilitate the deployment
using GitHub Actions cache.
website: https://github.com/mozilla/sccache
contact: https://github.com/mozilla/sccache/issues
license: "Apache-2.0"
grade: stable
confinement: classic

apps:
sccache:
command: bin/sccache
sccache-dist:
command: bin/sccache-dist
sccache:
command: bin/sccache
sccache-dist:
command: bin/sccache-dist

parts:
sccache:
plugin: rust
rust-channel: 1.70.0
rust-use-global-lto: true
source: .
override-pull: |
craftctl default
craftctl set version="$( git -C "${CRAFT_PART_SRC}" describe --tags )"
build-packages:
- libssl-dev
- make
- pkg-config
rust-features:
- all
- dist-server
build-attributes:
- enable-patchelf
sccache:
plugin: rust
rust-channel: 1.75.0
rust-use-global-lto: true
source: .
override-pull: |
craftctl default
craftctl set version="$( git -C "${CRAFT_PART_SRC}" describe --tags )"
build-packages:
- libssl-dev
- make
- pkg-config
rust-features:
- all
- dist-server
build-attributes:
- enable-patchelf
50 changes: 25 additions & 25 deletions src/bin/sccache-dist/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ impl OverlayBuilder {
// first, otherwise proc and dev get hidden
let mut cmd = Command::new(bubblewrap);
cmd.arg("--die-with-parent")
.args(&["--cap-drop", "ALL"])
.args(&[
.args(["--cap-drop", "ALL"])
.args([
"--unshare-user",
"--unshare-cgroup",
"--unshare-ipc",
Expand All @@ -363,8 +363,8 @@ impl OverlayBuilder {
.arg("--bind")
.arg(&target_dir)
.arg("/")
.args(&["--proc", "/proc"])
.args(&["--dev", "/dev"])
.args(["--proc", "/proc"])
.args(["--dev", "/dev"])
.arg("--chdir")
.arg(cwd);

Expand Down Expand Up @@ -467,15 +467,15 @@ const DOCKER_SHELL_INIT: &str = "while true; do /busybox sleep 365d && /busybox
// Check the diff and clean up the FS
fn docker_diff(cid: &str) -> Result<String> {
Command::new("docker")
.args(&["diff", cid])
.args(["diff", cid])
.check_stdout_trim()
.context("Failed to Docker diff container")
}

// Force remove the container
fn docker_rm(cid: &str) -> Result<()> {
Command::new("docker")
.args(&["rm", "-f", cid])
.args(["rm", "-f", cid])
.check_run()
.context("Failed to force delete container")
}
Expand Down Expand Up @@ -506,7 +506,7 @@ impl DockerBuilder {
info!("Performing initial Docker cleanup");

let containers = Command::new("docker")
.args(&["ps", "-a", "--format", "{{.ID}} {{.Image}}"])
.args(["ps", "-a", "--format", "{{.ID}} {{.Image}}"])
.check_stdout_trim()
.context("Unable to list all Docker containers")?;
if !containers.is_empty() {
Expand All @@ -519,7 +519,7 @@ impl DockerBuilder {
let image_name = iter
.next()
.context("Malformed container listing - no image name")?;
if iter.next() != None {
if iter.next().is_some() {
bail!("Malformed container listing - third field on row")
}
if image_name.starts_with("sccache-builder-") {
Expand All @@ -528,15 +528,15 @@ impl DockerBuilder {
}
if !containers_to_rm.is_empty() {
Command::new("docker")
.args(&["rm", "-f"])
.args(["rm", "-f"])
.args(containers_to_rm)
.check_run()
.context("Failed to start command to remove old containers")?;
}
}

let images = Command::new("docker")
.args(&["images", "--format", "{{.ID}} {{.Repository}}"])
.args(["images", "--format", "{{.ID}} {{.Repository}}"])
.check_stdout_trim()
.context("Failed to list all docker images")?;
if !images.is_empty() {
Expand All @@ -549,7 +549,7 @@ impl DockerBuilder {
let image_name = iter
.next()
.context("Malformed image listing - no image name")?;
if iter.next() != None {
if iter.next().is_some() {
bail!("Malformed image listing - third field on row")
}
if image_name.starts_with("sccache-builder-") {
Expand All @@ -558,7 +558,7 @@ impl DockerBuilder {
}
if !images_to_rm.is_empty() {
Command::new("docker")
.args(&["rmi"])
.args(["rmi"])
.args(images_to_rm)
.check_run()
.context("Failed to remove image")?
Expand All @@ -575,7 +575,7 @@ impl DockerBuilder {
fn get_container(&self, tc: &Toolchain, tccache: &Mutex<TcCache>) -> Result<String> {
let container = {
let mut map = self.container_lists.lock().unwrap();
map.entry(tc.clone()).or_insert_with(Vec::new).pop()
map.entry(tc.clone()).or_default().pop()
};
match container {
Some(cid) => Ok(cid),
Expand All @@ -602,7 +602,7 @@ impl DockerBuilder {
fn clean_container(&self, cid: &str) -> Result<()> {
// Clean up any running processes
Command::new("docker")
.args(&["exec", cid, "/busybox", "kill", "-9", "-1"])
.args(["exec", cid, "/busybox", "kill", "-9", "-1"])
.check_run()
.context("Failed to run kill on all processes in container")?;

Expand All @@ -617,7 +617,7 @@ impl DockerBuilder {
let changepath = iter
.next()
.context("Malformed container diff - no change path")?;
if iter.next() != None {
if iter.next().is_some() {
bail!("Malformed container diff - third field on row")
}
// TODO: If files are created in this dir, it gets marked as modified.
Expand All @@ -641,7 +641,7 @@ impl DockerBuilder {
}
lastpath = Some(changepath);
if let Err(e) = Command::new("docker")
.args(&["exec", cid, "/busybox", "rm", "-rf", changepath])
.args(["exec", cid, "/busybox", "rm", "-rf", changepath])
.check_run()
{
// We do a final check anyway, so just continue
Expand Down Expand Up @@ -695,7 +695,7 @@ impl DockerBuilder {

fn make_image(tc: &Toolchain, tccache: &Mutex<TcCache>) -> Result<String> {
let cid = Command::new("docker")
.args(&["create", BASE_DOCKER_IMAGE, "/busybox", "true"])
.args(["create", BASE_DOCKER_IMAGE, "/busybox", "true"])
.check_stdout_trim()
.context("Failed to create docker container")?;

Expand All @@ -713,7 +713,7 @@ impl DockerBuilder {

trace!("Copying in toolchain");
Command::new("docker")
.args(&["cp", "-", &format!("{}:/", cid)])
.args(["cp", "-", &format!("{}:/", cid)])
.check_piped(&mut |stdin| {
io::copy(&mut toolchain_rdr, stdin)?;
Ok(())
Expand All @@ -723,12 +723,12 @@ impl DockerBuilder {

let imagename = format!("sccache-builder-{}", &tc.archive_id);
Command::new("docker")
.args(&["commit", &cid, &imagename])
.args(["commit", &cid, &imagename])
.check_run()
.context("Failed to commit container after build")?;

Command::new("docker")
.args(&["rm", "-f", &cid])
.args(["rm", "-f", &cid])
.check_run()
.context("Failed to remove temporary build container")?;

Expand All @@ -737,7 +737,7 @@ impl DockerBuilder {

fn start_container(image: &str) -> Result<String> {
Command::new("docker")
.args(&[
.args([
"run",
"-d",
image,
Expand Down Expand Up @@ -765,7 +765,7 @@ impl DockerBuilder {

trace!("copying in inputs");
Command::new("docker")
.args(&["cp", "-", &format!("{}:/", cid)])
.args(["cp", "-", &format!("{}:/", cid)])
.check_piped(&mut |stdin| {
io::copy(&mut inputs_rdr, stdin)?;
Ok(())
Expand All @@ -784,7 +784,7 @@ impl DockerBuilder {
trace!("creating output directories");
assert!(!output_paths.is_empty());
let mut cmd = Command::new("docker");
cmd.args(&["exec", cid, "/busybox", "mkdir", "-p"]).arg(cwd);
cmd.args(["exec", cid, "/busybox", "mkdir", "-p"]).arg(cwd);
for path in output_paths.iter() {
// If it doesn't have a parent, nothing needs creating
let output_parent = if let Some(p) = Path::new(path).parent() {
Expand Down Expand Up @@ -812,7 +812,7 @@ impl DockerBuilder {
cmd.arg("-e").arg(env);
}
let shell_cmd = "cd \"$1\" && shift && exec \"$@\"";
cmd.args(&[cid, "/busybox", "sh", "-c", shell_cmd]);
cmd.args([cid, "/busybox", "sh", "-c", shell_cmd]);
cmd.arg(&executable);
cmd.arg(cwd);
cmd.arg(executable);
Expand All @@ -826,7 +826,7 @@ impl DockerBuilder {
let abspath = cwd.join(&path); // Resolve in case it's relative since we copy it from the root level
// TODO: this isn't great, but cp gives it out as a tar
let output = Command::new("docker")
.args(&["exec", cid, "/busybox", "cat"])
.args(["exec", cid, "/busybox", "cat"])
.arg(abspath)
.output()
.context("Failed to start command to retrieve output file")?;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/sccache-dist/cmdline/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ fn get_clap_command() -> ClapCommand {
])
.group(
ArgGroup::new("key_source_mutual_exclusion")
.args(&["config", "secret-key"])
.args(["config", "secret-key"])
.required(true),
),
)
Expand Down
Loading
Loading