From: Patrick Walton Date: Fri, 31 Jan 2014 20:36:00 +0000 (-0800) Subject: librustc: De-`@str` type short names X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=0f3a4e13f98125e550d0814fc69a93649eab8f0d;p=rust.git librustc: De-`@str` type short names --- diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index 9da19d66667..b7977f9d643 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -45,7 +45,7 @@ pub struct ctxt { pub struct ty_abbrev { pos: uint, len: uint, - s: @str + s: ~str } pub enum abbrev_ctxt { @@ -65,19 +65,21 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) { let short_names_cache = cx.tcx.short_names_cache.borrow(); result_str_opt = short_names_cache.get() .find(&t) - .map(|result| *result); + .map(|result| { + (*result).clone() + }); } let result_str = match result_str_opt { Some(s) => s, None => { let wr = &mut MemWriter::new(); enc_sty(wr, cx, &ty::get(t).sty); - let s = str::from_utf8(wr.get_ref()).unwrap().to_managed(); + let s = str::from_utf8(wr.get_ref()).unwrap(); let mut short_names_cache = cx.tcx .short_names_cache .borrow_mut(); - short_names_cache.get().insert(t, s); - s + short_names_cache.get().insert(t, s.to_str()); + s.to_str() } }; w.write(result_str.as_bytes()); @@ -103,7 +105,7 @@ fn estimate_sz(u: u64) -> u64 { let abbrev_len = 3 + estimate_sz(pos) + estimate_sz(len); if abbrev_len < len { // I.e. it's actually an abbreviation. - let s = format!("\\#{:x}:{:x}\\#", pos, len).to_managed(); + let s = format!("\\#{:x}:{:x}\\#", pos, len); let a = ty_abbrev { pos: pos as uint, len: len as uint, s: s }; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 681eabb797d..93bfe9c51e1 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -291,7 +291,7 @@ pub struct ctxt_ { freevars: RefCell, tcache: type_cache, rcache: creader_cache, - short_names_cache: RefCell>, + short_names_cache: RefCell>, needs_unwind_cleanup_cache: RefCell>, tc_cache: RefCell>, ast_ty_to_ty_cache: RefCell>,