From 1c1af99052b3a2fb32ed0ce4b5f68b7671e6e45e Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 1 May 2012 17:21:06 -0700 Subject: [PATCH] Fix symbol mangling in the presence of trailing version numbers. --- src/rustc/back/link.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rustc/back/link.rs b/src/rustc/back/link.rs index 8bf6c585557..8486af2d09e 100644 --- a/src/rustc/back/link.rs +++ b/src/rustc/back/link.rs @@ -466,6 +466,14 @@ fn sanitize(s: str) -> str { } } } + + // Underscore-qualify anything that didn't start as an ident. + if result.len() > 0u && + result[0] != '_' as u8 && + ! char::is_XID_start(result[0] as char) { + ret "_" + result; + } + ret result; }