diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 669c3248a1f..fc38fa25a21 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -510,7 +510,8 @@ fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str { pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &mut Sha256, t: ty::t, - link_meta: &LinkMeta) -> @str { + link_meta: &LinkMeta) + -> ~str { // NB: do *not* use abbrevs here as we want the symbol names // to be independent of one another in the crate. @@ -523,15 +524,14 @@ pub fn symbol_hash(tcx: ty::ctxt, let mut hash = truncated_hash_result(symbol_hasher); // Prefix with 'h' so that it never blends into adjacent digits hash.unshift_char('h'); - // tjc: allocation is unfortunate; need to change std::hash - hash.to_managed() + hash } -pub fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> @str { +pub fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> ~str { { let type_hashcodes = ccx.type_hashcodes.borrow(); match type_hashcodes.get().find(&t) { - Some(&h) => return h, + Some(h) => return h.to_str(), None => {} } } @@ -539,7 +539,7 @@ pub fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> @str { let mut type_hashcodes = ccx.type_hashcodes.borrow_mut(); let mut symbol_hasher = ccx.symbol_hasher.borrow_mut(); let hash = symbol_hash(ccx.tcx, symbol_hasher.get(), t, &ccx.link_meta); - type_hashcodes.get().insert(t, hash); + type_hashcodes.get().insert(t, hash.clone()); hash } diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs index 7968f034209..53f7b36b693 100644 --- a/src/librustc/middle/trans/context.rs +++ b/src/librustc/middle/trans/context.rs @@ -96,7 +96,7 @@ pub struct CrateContext { llsizingtypes: RefCell>, adt_reprs: RefCell>, symbol_hasher: RefCell, - type_hashcodes: RefCell>, + type_hashcodes: RefCell>, all_llvm_symbols: RefCell>, tcx: ty::ctxt, maps: astencode::Maps,