From a129dc20c31338ef11e0a57eaab2c59f513eca3e Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Mon, 27 Mar 2023 13:13:05 -0700 Subject: [PATCH] Stable rust patch Signed-off-by: Alex Saveau --- Cargo.lock | 8 +++++--- Cargo.toml | 3 ++- cpz/Cargo.toml | 4 +++- cpz/src/main.rs | 10 +++++----- fuc_engine/Cargo.toml | 2 ++ fuc_engine/src/lib.rs | 1 - fuc_engine/src/ops/copy.rs | 5 +++-- fuc_engine/src/ops/remove.rs | 4 ++-- rmz/Cargo.toml | 3 ++- rust-toolchain | 1 - 10 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 rust-toolchain diff --git a/Cargo.lock b/Cargo.lock index 3174a80..e7e3778 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -365,7 +365,7 @@ version = "0.0.0" [[package]] name = "cpz" -version = "1.1.6" +version = "2.0.0" dependencies = [ "cache-size", "clap", @@ -374,6 +374,7 @@ dependencies = [ "fuc_engine", "indicatif", "memmap2", + "once_cell", "rand", "rustix", "supercilex-tests", @@ -614,11 +615,12 @@ dependencies = [ [[package]] name = "fuc_engine" -version = "1.1.6" +version = "2.0.0" dependencies = [ "crossbeam-channel", "ftzz", "io-adapters", + "once_cell", "rayon", "remove_dir_all", "rstest", @@ -1323,7 +1325,7 @@ version = "0.0.0" [[package]] name = "rmz" -version = "1.1.6" +version = "2.0.0" dependencies = [ "clap", "criterion", diff --git a/Cargo.toml b/Cargo.toml index a8538fb..5e334bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,11 +13,12 @@ members = [ ] [workspace.package] -version = "1.1.6" +version = "2.0.0" authors = ["Alex Saveau "] edition = "2021" repository = "https://github.com/SUPERCILEX/fuc" license = "Apache-2.0" +rust-version = "1.79" [package] name = "lint" diff --git a/cpz/Cargo.toml b/cpz/Cargo.toml index e10fe30..482028b 100644 --- a/cpz/Cargo.toml +++ b/cpz/Cargo.toml @@ -8,11 +8,13 @@ repository.workspace = true keywords = ["tools", "files", "cp"] categories = ["command-line-utilities", "development-tools", "filesystem"] license.workspace = true +rust-version.workspace = true [dependencies] clap = { version = "4.5.8", features = ["derive", "wrap_help"] } error-stack = "0.4.1" -fuc_engine = { version = "1", path = "../fuc_engine" } +fuc_engine = { version = "2", path = "../fuc_engine" } +once_cell = "1.18.0" indicatif = { version = "0.17.8", optional = true } thiserror = "1.0.61" tracing = { version = "0.1.40", optional = true } diff --git a/cpz/src/main.rs b/cpz/src/main.rs index 2809559..867a986 100644 --- a/cpz/src/main.rs +++ b/cpz/src/main.rs @@ -1,7 +1,4 @@ -#![feature(let_chains)] - use std::{ - cell::LazyCell, fs, mem::swap, path::{PathBuf, MAIN_SEPARATOR, MAIN_SEPARATOR_STR}, @@ -10,6 +7,7 @@ use std::{ use clap::{ArgAction, Parser, ValueHint}; use error_stack::Report; use fuc_engine::{CopyOp, Error}; +use once_cell::sync::Lazy as LazyCell; /// A zippy alternative to `cp`, a tool to copy files and directories #[derive(Parser, Debug)] @@ -260,8 +258,10 @@ fn copy( let to = { let is_into_directory = *is_into_directory; let mut to = to; - if is_into_directory && let Some(name) = from.file_name() { - to.push(name); + if is_into_directory { + if let Some(name) = from.file_name() { + to.push(name); + } } to }; diff --git a/fuc_engine/Cargo.toml b/fuc_engine/Cargo.toml index 07cd959..10b71ac 100644 --- a/fuc_engine/Cargo.toml +++ b/fuc_engine/Cargo.toml @@ -8,9 +8,11 @@ repository.workspace = true keywords = ["tools", "files"] categories = ["filesystem"] license.workspace = true +rust-version.workspace = true [dependencies] crossbeam-channel = "0.5.13" +once_cell = "1.18.0" thiserror = "1.0.61" tracing = { version = "0.1.40", default-features = false, features = ["attributes"], optional = true } typed-builder = "0.18.2" diff --git a/fuc_engine/src/lib.rs b/fuc_engine/src/lib.rs index 113538c..584e39c 100644 --- a/fuc_engine/src/lib.rs +++ b/fuc_engine/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(lazy_cell_consume)] #![allow(clippy::used_underscore_binding)] #![allow(clippy::needless_pass_by_value)] diff --git a/fuc_engine/src/ops/copy.rs b/fuc_engine/src/ops/copy.rs index f76a60f..7114e75 100644 --- a/fuc_engine/src/ops/copy.rs +++ b/fuc_engine/src/ops/copy.rs @@ -140,7 +140,7 @@ fn schedule_copies< mod compat { use std::{ borrow::Cow, - cell::{Cell, LazyCell}, + cell::Cell, env, ffi::{CStr, CString}, fmt::{Debug, Formatter}, @@ -155,6 +155,7 @@ mod compat { }; use crossbeam_channel::{Receiver, Sender}; + use once_cell::sync::Lazy as LazyCell; use rustix::{ fs::{ copy_file_range, mkdirat, openat, readlinkat, statx, symlinkat, AtFlags, FileType, @@ -210,7 +211,7 @@ mod compat { fn finish(self) -> Result<(), Error> { let Self { scheduling } = self; - if let Ok((tasks, thread)) = LazyCell::into_inner(scheduling) { + if let Ok((tasks, thread)) = LazyCell::into_value(scheduling) { drop(tasks); thread.join().map_err(|_| Error::Join)??; } diff --git a/fuc_engine/src/ops/remove.rs b/fuc_engine/src/ops/remove.rs index eac6bc9..139165f 100644 --- a/fuc_engine/src/ops/remove.rs +++ b/fuc_engine/src/ops/remove.rs @@ -116,7 +116,6 @@ fn schedule_deletions<'a, I: Into>, F: IntoIterator>( mod compat { use std::{ borrow::Cow, - cell::LazyCell, env, env::{current_dir, set_current_dir}, ffi::{CStr, CString, OsStr}, @@ -135,6 +134,7 @@ mod compat { }; use crossbeam_channel::{Receiver, Sender}; + use once_cell::sync::Lazy as LazyCell; use rustix::{ fs::{openat, unlinkat, AtFlags, FileType, Mode, OFlags, RawDir, CWD}, thread::{unshare, UnshareFlags}, @@ -183,7 +183,7 @@ mod compat { fn finish(self) -> Result<(), Error> { let Self { scheduling } = self; - if let Ok((tasks, thread)) = LazyCell::into_inner(scheduling) { + if let Ok((tasks, thread)) = LazyCell::into_value(scheduling) { drop(tasks); thread.join().map_err(|_| Error::Join)??; } diff --git a/rmz/Cargo.toml b/rmz/Cargo.toml index a244ed6..3374868 100644 --- a/rmz/Cargo.toml +++ b/rmz/Cargo.toml @@ -8,11 +8,12 @@ repository.workspace = true keywords = ["tools", "files", "rm"] categories = ["command-line-utilities", "development-tools", "filesystem"] license.workspace = true +rust-version.workspace = true [dependencies] clap = { version = "4.5.8", features = ["derive", "wrap_help"] } error-stack = "0.4.1" -fuc_engine = { version = "1", path = "../fuc_engine" } +fuc_engine = { version = "2", path = "../fuc_engine" } indicatif = { version = "0.17.8", optional = true } thiserror = "1.0.61" tracing = { version = "0.1.40", optional = true } diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index bf867e0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly