Skip to content

Commit a60c6a8

Browse files
committed
auto merge of #8903 : luqmana/rust/en, r=thestinger
Fixes #8735.
2 parents 04fac7f + ba5f101 commit a60c6a8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/librustc/middle/trans/base.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -2453,10 +2453,16 @@ pub fn item_path(ccx: &CrateContext, id: &ast::NodeId) -> path {
24532453
}
24542454

24552455
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)
24602466
}
24612467
}
24622468

0 commit comments

Comments
 (0)