@@ -45,7 +45,7 @@ pub struct ctxt {
45
45
pub struct ty_abbrev {
46
46
pos : uint ,
47
47
len : uint ,
48
- s : @ str
48
+ s : ~ str
49
49
}
50
50
51
51
pub enum abbrev_ctxt {
@@ -65,19 +65,21 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) {
65
65
let short_names_cache = cx. tcx . short_names_cache . borrow ( ) ;
66
66
result_str_opt = short_names_cache. get ( )
67
67
. find ( & t)
68
- . map ( |result| * result) ;
68
+ . map ( |result| {
69
+ ( * result) . clone ( )
70
+ } ) ;
69
71
}
70
72
let result_str = match result_str_opt {
71
73
Some ( s) => s,
72
74
None => {
73
75
let wr = & mut MemWriter :: new ( ) ;
74
76
enc_sty ( wr, cx, & ty:: get ( t) . sty ) ;
75
- let s = str:: from_utf8 ( wr. get_ref ( ) ) . unwrap ( ) . to_managed ( ) ;
77
+ let s = str:: from_utf8 ( wr. get_ref ( ) ) . unwrap ( ) ;
76
78
let mut short_names_cache = cx. tcx
77
79
. short_names_cache
78
80
. borrow_mut ( ) ;
79
- short_names_cache. get ( ) . insert ( t, s) ;
80
- s
81
+ short_names_cache. get ( ) . insert ( t, s. to_str ( ) ) ;
82
+ s. to_str ( )
81
83
}
82
84
} ;
83
85
w. write ( result_str. as_bytes ( ) ) ;
@@ -103,7 +105,7 @@ pub fn enc_ty(w: &mut MemWriter, cx: @ctxt, t: ty::t) {
103
105
let abbrev_len = 3 + estimate_sz ( pos) + estimate_sz ( len) ;
104
106
if abbrev_len < len {
105
107
// I.e. it's actually an abbreviation.
106
- let s = format ! ( "\\ #{:x}:{:x}\\ #" , pos, len) . to_managed ( ) ;
108
+ let s = format ! ( "\\ #{:x}:{:x}\\ #" , pos, len) ;
107
109
let a = ty_abbrev { pos : pos as uint ,
108
110
len : len as uint ,
109
111
s : s } ;
0 commit comments