}
type LocalCache = @mut HashMap<~str, @~[u8]>;
-fn tls_key(_k: @LocalCache) {}
+fn tls_key(_k: LocalCache) {}
impl Program {
pub fn new() -> Program {
");
let key: sys::Closure = unsafe {
- let tls_key: &'static fn(@LocalCache) = tls_key;
+ let tls_key: &'static fn(LocalCache) = tls_key;
cast::transmute(tls_key)
};
// First, get a handle to the tls map which stores all the local
let key = ::std::sys::Closure{ code: %? as *(),
env: ::std::ptr::null() };
let key = ::std::cast::transmute(key);
- *::std::local_data::get(key, |k| k.map(|&x| *x)).unwrap()
+ ::std::local_data::get(key, |k| k.map(|&x| *x)).unwrap()
};\n", key.code as uint));
// Using this __tls_map handle, deserialize each variable binding that
map.insert(copy *name, @copy value.data);
}
unsafe {
- local_data::set(tls_key, @map);
+ local_data::set(tls_key, map);
}
}
unsafe {
fn my_key(_x: @~str) { }
set(my_key, @~"weasel");
- assert!(*(pop(my_key, |k| k.map(|&k| *k)).get()) == ~"weasel");
+ assert!(*(pop(my_key).get()) == ~"weasel");
// Pop must remove the data from the map.
assert!(pop(my_key).is_none());
}
// Testing that we can't store a borrowed pointer it task-local storage
-use std::local_data::*;
+use std::local_data;
fn key(_x: @&int) { }
fn main() {
unsafe {
- local_data_set(key, @&0); //~ ERROR does not fulfill `'static`
+ local_data::set(key, @&0); //~ ERROR does not fulfill `'static`
}
}