aboutsummaryrefslogtreecommitdiffstats
path: root/components/util
diff options
context:
space:
mode:
Diffstat (limited to 'components/util')
-rw-r--r--components/util/persistent_list.rs11
-rw-r--r--components/util/tid.rs4
2 files changed, 3 insertions, 12 deletions
diff --git a/components/util/persistent_list.rs b/components/util/persistent_list.rs
index 55d2b6cd2fd..9043fe76e54 100644
--- a/components/util/persistent_list.rs
+++ b/components/util/persistent_list.rs
@@ -4,7 +4,6 @@
//! A persistent, thread-safe singly-linked list.
-use std::mem;
use std::sync::Arc;
pub struct PersistentList<T> {
@@ -81,15 +80,7 @@ impl<'a, T> Iterator for PersistentListIterator<'a, T> where T: Send + Sync + 's
fn next(&mut self) -> Option<&'a T> {
let entry = match self.entry {
None => return None,
- Some(entry) => {
- // This `transmute` is necessary to ensure that the lifetimes of the next entry and
- // this entry match up; the compiler doesn't know this, but we do because of the
- // reference counting behavior of `Arc`.
- unsafe {
- mem::transmute::<&'a PersistentListEntry<T>,
- &'static PersistentListEntry<T>>(entry)
- }
- }
+ Some(entry) => entry,
};
let value = &entry.value;
self.entry = match entry.next {
diff --git a/components/util/tid.rs b/components/util/tid.rs
index a07508cdb2b..ebed22881b3 100644
--- a/components/util/tid.rs
+++ b/components/util/tid.rs
@@ -6,7 +6,7 @@ use std::cell::RefCell;
use std::rc::Rc;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
-static mut next_tid: AtomicUsize = ATOMIC_USIZE_INIT;
+static NEXT_TID: AtomicUsize = ATOMIC_USIZE_INIT;
thread_local!(static TASK_LOCAL_TID: Rc<RefCell<Option<usize>>> = Rc::new(RefCell::new(None)));
@@ -15,7 +15,7 @@ pub fn tid() -> usize {
TASK_LOCAL_TID.with(|ref k| {
let ret =
match *k.borrow() {
- None => unsafe { next_tid.fetch_add(1, Ordering::SeqCst) },
+ None => NEXT_TID.fetch_add(1, Ordering::SeqCst),
Some(x) => x,
};