Skip to content

Commit ce09654

Browse files
committed
Fix a variance safety issue where AtomicRef<'static, T> could be cast to AtomicRef<'a, T>
1 parent ec1b06b commit ce09654

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "atomic_ref"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
authors = ["Michael Layzell <michael@thelayzells.com>"]
55

66
description = "Atomic &'a T types with support for static allocation"

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
//! }
7373
//! ```
7474
75+
use std::sync::Mutex;
7576
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
7677
use std::marker::PhantomData;
7778
use std::fmt;
@@ -81,7 +82,7 @@ use std::default::Default;
8182
#[repr(C)]
8283
pub struct AtomicRef<'a, T: 'a> {
8384
data: AtomicUsize,
84-
_marker: PhantomData<&'a T>,
85+
_marker: PhantomData<Mutex<&'a T>>,
8586
}
8687

8788
/// You will probably never need to use this type. It exists mostly for internal

0 commit comments

Comments
 (0)