Skip to content

Commit 9d764fc

Browse files
committed
Do not generate '@' character in symbol names.
MSP430 assembler does not like '@' character in symbol names, so we should only use alphanumerics when we generate a new name. Fixes rust-lang#38116
1 parent b4b1e5e commit 9d764fc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: src/librustc_data_structures/base_n.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use std::str;
1515

1616
pub const MAX_BASE: u64 = 64;
17+
pub const ALPHANUMERIC_ONLY: u64 = 62;
18+
1719
const BASE_64: &'static [u8; MAX_BASE as usize] =
1820
b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@$";
1921

Diff for: src/librustc_trans/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
971971
let mut name = String::with_capacity(prefix.len() + 6);
972972
name.push_str(prefix);
973973
name.push_str(".");
974-
base_n::push_str(idx as u64, base_n::MAX_BASE, &mut name);
974+
base_n::push_str(idx as u64, base_n::ALPHANUMERIC_ONLY, &mut name);
975975
name
976976
}
977977
}

0 commit comments

Comments
 (0)