From 1cbc3e0cadffff3dc460406961112bf81b5a5012 Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Tue, 12 Jan 2021 11:17:41 -0800 Subject: [PATCH 1/4] Start GitHub Actions. --- .github/workflows/rust.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..3c13d1b --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,22 @@ +name: Rust + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose From c20bc880841bca31e1948f1cbbc38399e62a6b2a Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Tue, 12 Jan 2021 14:37:31 -0800 Subject: [PATCH 2/4] Not use core intrinsics. --- Cargo.toml | 1 + src/lib.rs | 1 - src/rc.rs | 5 +++-- src/sync.rs | 3 ++- src/util/mod.rs | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a2c235c..34016c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ documentation = "https://docs.rs/containers/" edition = "2018" [dependencies] +abort = "0.1.3" alloc = { package = "loca", version = "0.7" } default_allocator = { version = "0.3", optional = true } either = { version = "1.4", default-features = false } diff --git a/src/lib.rs b/src/lib.rs index b2ed001..4da0e38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,6 @@ #![feature(non_ascii_idents)] #![feature(coerce_unsized)] -#![feature(core_intrinsics)] #![feature(const_fn)] #![feature(const_mut_refs)] #![feature(dropck_eyepatch)] diff --git a/src/rc.rs b/src/rc.rs index 043eeb8..5b1e2ba 100644 --- a/src/rc.rs +++ b/src/rc.rs @@ -1,5 +1,6 @@ -use core::{cell::Cell, fmt, marker::Unsize, ops::{CoerceUnsized, Deref}, ptr::{self, NonNull}}; +use abort::abort; use alloc::{Alloc, Layout}; +use core::{cell::Cell, fmt, marker::Unsize, ops::{CoerceUnsized, Deref}, ptr::{self, NonNull}}; use crate::boxed::Box; @@ -72,7 +73,7 @@ impl Clone for Rc { const MAX_REFCOUNT: usize = isize::max_value() as _; let old_size = self.inner().strong.get(); self.inner().strong.set(old_size + 1); - if old_size > MAX_REFCOUNT { ::core::intrinsics::abort() } + if old_size > MAX_REFCOUNT { abort() } Self { ptr: self.ptr, alloc: self.alloc.clone() } } } diff --git a/src/sync.rs b/src/sync.rs index 98cdc14..2184f4e 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -1,3 +1,4 @@ +use abort::abort; use alloc::{Alloc, Layout}; use core::{fmt, marker::Unsize, mem, ptr}; use core::ops::{Deref, CoerceUnsized}; @@ -77,7 +78,7 @@ impl Deref for Arc { impl Clone for Arc { #[inline] fn clone(&self) -> Self { - if self.inner().strong.fetch_add(1, Memord::Relaxed) > ::core::isize::MAX as _ { ::core::intrinsics::abort() } + if self.inner().strong.fetch_add(1, Memord::Relaxed) > ::core::isize::MAX as _ { abort() } Self { ptr: self.ptr, alloc: self.alloc.clone() } } } diff --git a/src/util/mod.rs b/src/util/mod.rs index 27b8fda..f139324 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,3 +1,4 @@ +use abort::abort; use core::mem; use core::ptr; @@ -35,7 +36,7 @@ struct AbortOnDrop; impl Drop for AbortOnDrop { #[inline(always)] - fn drop(&mut self) { ::core::intrinsics::abort() } + fn drop(&mut self) { abort() } } #[inline(always)] From a85f118aed44ee620516be15a5b1c4bb99ed2c3e Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Wed, 30 Jun 2021 22:43:09 -0800 Subject: [PATCH 3/4] latest features --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 4da0e38..451e873 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,9 +2,9 @@ #![deny(missing_debug_implementations)] -#![feature(non_ascii_idents)] #![feature(coerce_unsized)] #![feature(const_fn)] +#![feature(const_fn_trait_bound)] #![feature(const_mut_refs)] #![feature(dropck_eyepatch)] #![feature(unsize)] From 72bdffde66b3bd29010c060d5b115aa463c1fde8 Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Wed, 30 Jun 2021 22:43:34 -0800 Subject: [PATCH 4/4] bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 34016c7..dbdad61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "containers" -version = "0.9.11" +version = "0.9.12" authors = ["M Farkas-Dyck "] description = "Containers" license = "MIT OR Apache-2.0"