Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- nightly
- beta
- stable
- 1.56.1 # MSRV
- 1.59.0 # MSRV

timeout-minutes: 10

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

* Increase MSRV to 1.59.0 because of `rayon-core v1.11.0`.

## 0.14.1 (2022-07-14)

* Undo performance regression from removing `hashbrown` by using `ahash` hasher
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories = ["concurrency"]
license = "MIT OR Apache-2.0"
exclude = ["bors.toml", ".travis.yml"]
edition = "2021"
rust-version = "1.56.1"
rust-version = "1.59.0"

[dependencies]
ahash = "0.7.6"
Expand Down
16 changes: 13 additions & 3 deletions src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::ptr::NonNull;
use std::{
cell::UnsafeCell,
error::Error,
fmt::{Display, Error as FormatError, Formatter},
fmt::{Debug, Display, Error as FormatError, Formatter},
ops::{Deref, DerefMut},
sync::atomic::{AtomicUsize, Ordering},
usize,
Expand Down Expand Up @@ -41,7 +41,6 @@ impl Error for InvalidBorrow {
/// An immutable reference to data in a `TrustCell`.
///
/// Access the value via `std::ops::Deref` (e.g. `*val`)
#[derive(Debug)]
pub struct Ref<'a, T: ?Sized + 'a> {
flag: &'a AtomicUsize,
value: NonNull<T>,
Expand Down Expand Up @@ -135,10 +134,15 @@ impl<'a, T: ?Sized> Clone for Ref<'a, T> {
}
}

impl<'a, T: ?Sized + Debug> Debug for Ref<'a, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FormatError> {
<T as Debug>::fmt(self, f)
}
}

/// A mutable reference to data in a `TrustCell`.
///
/// Access the value via `std::ops::DerefMut` (e.g. `*val`)
#[derive(Debug)]
pub struct RefMut<'a, T: ?Sized + 'a> {
flag: &'a AtomicUsize,
value: NonNull<T>,
Expand Down Expand Up @@ -245,6 +249,12 @@ impl<'a, T: ?Sized> Drop for RefMut<'a, T> {
}
}

impl<'a, T: ?Sized + Debug> Debug for RefMut<'a, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FormatError> {
<T as Debug>::fmt(self, f)
}
}

/// A custom cell container that is a `RefCell` with thread-safety.
#[derive(Debug)]
pub struct TrustCell<T> {
Expand Down