diff options
| author | bors <bors@rust-lang.org> | 2013-09-09 02:36:06 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-09 02:36:06 -0700 |
| commit | fd49f6dce11033496a87d08d66114a86b2d85d59 (patch) | |
| tree | f0126a3c76aaf6318a6dc85796d6cb1f24ccedae /src/libstd | |
| parent | d09f569aac99a4ef2f577d288d547504e3dcf588 (diff) | |
| parent | 500077f637114be0ac9e6ef5fb92933c4c97804d (diff) | |
| download | rust-fd49f6dce11033496a87d08d66114a86b2d85d59.tar.gz rust-fd49f6dce11033496a87d08d66114a86b2d85d59.zip | |
auto merge of #9073 : alexcrichton/rust/remove-local-data-hax, r=huonw
These compiler bugs have since been fixed (one less layer of indirection)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/local_data.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 88e7dd692fe..a13c75635dc 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -155,13 +155,13 @@ pub fn pop<T: 'static>(key: Key<T>) -> Option<T> { // Move `data` into transmute to get out the memory that it // owns, we must free it manually later. - let (_vtable, box): (uint, ~~T) = unsafe { + let (_vtable, box): (uint, ~T) = unsafe { cast::transmute(data) }; // Now that we own `box`, we can just move out of it as we would // with any other data. - return Some(**box); + return Some(*box); } _ => {} } @@ -244,13 +244,13 @@ fn get_with<T: 'static, U>(key: Key<T>, want.describe(), cur.describe()); } } - // data was created with `~~T as ~LocalData`, so we extract - // pointer part of the trait, (as ~~T), and then use + // data was created with `~T as ~LocalData`, so we extract + // pointer part of the trait, (as ~T), and then use // compiler coercions to achieve a '&' pointer. unsafe { - match *cast::transmute::<&TLSValue, &(uint, ~~T)>(data){ + match *cast::transmute::<&TLSValue, &(uint, ~T)>(data){ (_vtable, ref box) => { - let value: &T = **box; + let value: &T = *box; ret = f(Some(value)); } } @@ -294,9 +294,7 @@ pub fn set<T: 'static>(key: Key<T>, data: T) { // everything to a trait (LocalData) which is then stored inside the map. // Upon destruction of the map, all the objects will be destroyed and the // traits have enough information about them to destroy themselves. - // - // FIXME(#7673): This should be "~data as ~LocalData" (only one sigil) - let data = ~~data as ~LocalData:; + let data = ~data as ~LocalData:; fn insertion_position(map: &mut Map, key: *libc::c_void) -> Option<uint> { |
