diff options
Diffstat (limited to 'src/libstd/local_data.rs')
| -rw-r--r-- | src/libstd/local_data.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 6c1640e683e..168bb7c14f0 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -135,9 +135,11 @@ pub fn modify<T: 'static>(key: Key<@T>, f: &fn(Option<@T>) -> Option<@T>) { */ #[cfg(not(stage0))] pub fn modify<T: 'static>(key: Key<T>, f: &fn(Option<T>) -> Option<T>) { - match f(pop(key)) { - Some(next) => { set(key, next); } - None => {} + unsafe { + match f(pop(::cast::unsafe_copy(&key))) { + Some(next) => { set(key, next); } + None => {} + } } } |
