Skip to content

Commit

Permalink
core: Replace Durable with 'static
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed May 7, 2013
1 parent 6bcc3a6 commit 398cd18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/libcore/task/local_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub type LocalDataKey<'self,T> = &'self fn(v: @T);
* Remove a task-local data value from the table, returning the
* reference that was originally created to insert it.
*/
pub unsafe fn local_data_pop<T:Durable>(
pub unsafe fn local_data_pop<T: 'static>(
key: LocalDataKey<T>) -> Option<@T> {

local_pop(Handle::new(), key)
Expand All @@ -58,7 +58,7 @@ pub unsafe fn local_data_pop<T:Durable>(
* Retrieve a task-local data value. It will also be kept alive in the
* table until explicitly removed.
*/
pub unsafe fn local_data_get<T:Durable>(
pub unsafe fn local_data_get<T: 'static>(
key: LocalDataKey<T>) -> Option<@T> {

local_get(Handle::new(), key)
Expand All @@ -67,7 +67,7 @@ pub unsafe fn local_data_get<T:Durable>(
* Store a value in task-local data. If this key already has a value,
* that value is overwritten (and its destructor is run).
*/
pub unsafe fn local_data_set<T:Durable>(
pub unsafe fn local_data_set<T: 'static>(
key: LocalDataKey<T>, data: @T) {

local_set(Handle::new(), key, data)
Expand All @@ -76,7 +76,7 @@ pub unsafe fn local_data_set<T:Durable>(
* Modify a task-local data value. If the function returns 'None', the
* data is removed (and its reference dropped).
*/
pub unsafe fn local_data_modify<T:Durable>(
pub unsafe fn local_data_modify<T: 'static>(
key: LocalDataKey<T>,
modify_fn: &fn(Option<@T>) -> Option<@T>) {

Expand Down
16 changes: 8 additions & 8 deletions src/libcore/task/local_data_priv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl Handle {
}

pub trait LocalData { }
impl<T:Durable> LocalData for @T { }
impl<T: 'static> LocalData for @T { }

impl Eq for @LocalData {
fn eq(&self, other: &@LocalData) -> bool {
Expand Down Expand Up @@ -131,15 +131,15 @@ unsafe fn get_newsched_local_map(local: *mut LocalStorage) -> TaskLocalMap {
}
}

unsafe fn key_to_key_value<T:Durable>(key: LocalDataKey<T>) -> *libc::c_void {
unsafe fn key_to_key_value<T: 'static>(key: LocalDataKey<T>) -> *libc::c_void {
// Keys are closures, which are (fnptr,envptr) pairs. Use fnptr.
// Use reintepret_cast -- transmute would leak (forget) the closure.
let pair: (*libc::c_void, *libc::c_void) = cast::transmute_copy(&key);
pair.first()
}

// If returning Some(..), returns with @T with the map's reference. Careful!
unsafe fn local_data_lookup<T:Durable>(
unsafe fn local_data_lookup<T: 'static>(
map: TaskLocalMap, key: LocalDataKey<T>)
-> Option<(uint, *libc::c_void)> {

Expand All @@ -157,7 +157,7 @@ unsafe fn local_data_lookup<T:Durable>(
}
}

unsafe fn local_get_helper<T:Durable>(
unsafe fn local_get_helper<T: 'static>(
handle: Handle, key: LocalDataKey<T>,
do_pop: bool) -> Option<@T> {

Expand All @@ -179,21 +179,21 @@ unsafe fn local_get_helper<T:Durable>(
}


pub unsafe fn local_pop<T:Durable>(
pub unsafe fn local_pop<T: 'static>(
handle: Handle,
key: LocalDataKey<T>) -> Option<@T> {

local_get_helper(handle, key, true)
}

pub unsafe fn local_get<T:Durable>(
pub unsafe fn local_get<T: 'static>(
handle: Handle,
key: LocalDataKey<T>) -> Option<@T> {

local_get_helper(handle, key, false)
}

pub unsafe fn local_set<T:Durable>(
pub unsafe fn local_set<T: 'static>(
handle: Handle, key: LocalDataKey<T>, data: @T) {

let map = get_local_map(handle);
Expand Down Expand Up @@ -225,7 +225,7 @@ pub unsafe fn local_set<T:Durable>(
}
}

pub unsafe fn local_modify<T:Durable>(
pub unsafe fn local_modify<T: 'static>(
handle: Handle, key: LocalDataKey<T>,
modify_fn: &fn(Option<@T>) -> Option<@T>) {

Expand Down

0 comments on commit 398cd18

Please sign in to comment.