1
Fork 0

Use a faked-up function as a key, because functions aren't identical cross-crate in Windows.

This commit is contained in:
Paul Stansifer 2012-08-24 12:19:19 -07:00
parent 0f996f70a6
commit aa024acae3
3 changed files with 30 additions and 10 deletions

View file

@ -5,18 +5,24 @@ import doc::item_utils;
export from_srv, extract, to_str, interner;
/* can't import macros yet, so this is copied from token.rs. See its comment
* there. */
macro_rules! interner_key (
() => (unsafe::transmute::<(uint, uint),
&fn(+@@syntax::parse::token::ident_interner)>((-3 as uint, 0u)))
)
// Hack; rather than thread an interner through everywhere, rely on
// thread-local data
fn to_str(id: ast::ident) -> ~str {
let intr = unsafe{ task::local_data_get(
syntax::parse::token::interner_key) };
let intr = unsafe{ task::local_data_get(interner_key!()) };
return *(*intr.get()).get(id);
}
fn interner() -> syntax::parse::token::ident_interner {
return *(unsafe{ task::local_data_get(
syntax::parse::token::interner_key) }).get();
return *(unsafe{ task::local_data_get(interner_key!()) }).get();
}
fn from_srv(