File tree 1 file changed +10
-4
lines changed
src/librustc/middle/trans
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -2453,10 +2453,16 @@ pub fn item_path(ccx: &CrateContext, id: &ast::NodeId) -> path {
2453
2453
}
2454
2454
2455
2455
fn exported_name ( ccx : @mut CrateContext , path : path , ty : ty:: t , attrs : & [ ast:: Attribute ] ) -> ~str {
2456
- if attr:: contains_name ( attrs, "no_mangle" ) {
2457
- path_elt_to_str ( * path. last ( ) , token:: get_ident_interner ( ) )
2458
- } else {
2459
- mangle_exported_name ( ccx, path, ty)
2456
+ match attr:: first_attr_value_str_by_name ( attrs, "export_name" ) {
2457
+ // Use provided name
2458
+ Some ( name) => name. to_owned ( ) ,
2459
+
2460
+ // Don't mangle
2461
+ _ if attr:: contains_name ( attrs, "no_mangle" )
2462
+ => path_elt_to_str ( * path. last ( ) , token:: get_ident_interner ( ) ) ,
2463
+
2464
+ // Usual name mangling
2465
+ _ => mangle_exported_name ( ccx, path, ty)
2460
2466
}
2461
2467
}
2462
2468
You can’t perform that action at this time.
0 commit comments