@@ -184,7 +184,7 @@ fn path_name(vec[str] path) -> str {
184
184
}
185
185
186
186
187
- fn mangle_name_by_type ( @crate_ctxt ccx , vec [ str ] path , ty . t t) -> str {
187
+ fn get_type_sha1 ( @crate_ctxt ccx , ty . t t) -> str {
188
188
auto hash = "" ;
189
189
alt ( ccx. type_sha1s . find ( t) ) {
190
190
case ( some[ str] ( ?h) ) { hash = h; }
@@ -200,9 +200,24 @@ fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
200
200
ccx. type_sha1s . insert ( t, hash) ;
201
201
}
202
202
}
203
+ ret hash;
204
+ }
205
+
206
+ fn mangle_name_by_type ( @crate_ctxt ccx , vec[ str] path , ty . t t) -> str {
207
+ auto hash = get_type_sha1 ( ccx, t) ;
203
208
ret sep ( ) + "rust" + sep ( ) + hash + sep ( ) + path_name ( path) ;
204
209
}
205
210
211
+ fn mangle_name_by_type_only ( @crate_ctxt ccx , ty . t t, str name ) -> str {
212
+ auto f = metadata. def_to_str ;
213
+ auto cx = @rec ( ds=f, tcx=ccx. tcx ,
214
+ use_abbrevs=false , abbrevs=ccx. type_abbrevs ) ;
215
+ auto s = metadata. Encode . ty_str ( cx, t) ;
216
+
217
+ auto hash = get_type_sha1 ( ccx, t) ;
218
+ ret sep( ) + "rust" + sep ( ) + hash + sep ( ) + name + "_" + s;
219
+ }
220
+
206
221
fn mangle_name_by_seq ( @crate_ctxt ccx , vec[ str] path , str flav ) -> str {
207
222
ret sep ( ) + "rust" + sep ( )
208
223
+ ccx. names . next ( flav) + sep ( )
@@ -1774,8 +1789,7 @@ fn declare_generic_glue(@local_ctxt cx,
1774
1789
ty. t t,
1775
1790
TypeRef llfnty,
1776
1791
str name) -> ValueRef {
1777
- auto gcx = @rec( path=vec( "glue" , name) with * cx) ;
1778
- auto fn_nm = mangle_name_by_seq( cx. ccx, cx. path, "glue" ) ;
1792
+ auto fn_nm = mangle_name_by_type_only( cx. ccx, t, "glue_" + name) ;
1779
1793
fn_nm = sanitize( fn_nm) ;
1780
1794
auto llfn = decl_internal_fastcall_fn( cx. ccx. llmod, fn_nm, llfnty) ;
1781
1795
ret llfn;
0 commit comments