Do not intern NUL terminators

The C representation needed by LLVM requires strings to be
NUL-terminated, but on the Rust side they should not contain unwanted
NULs.
This commit is contained in:
Andrea Canciani 2016-04-10 14:21:00 +02:00
parent 3fc5d2746e
commit f942c28900
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ pub fn add_configuration(cfg: &mut ast::CrateConfig, sess: &Session) {
let tf = InternedString::new("target_feature");
for feat in whitelist {
if unsafe { LLVMRustHasFeature(target_machine, feat.as_ptr() as *const c_char) } {
cfg.push(attr::mk_name_value_item_str(tf.clone(), intern(feat)))
cfg.push(attr::mk_name_value_item_str(tf.clone(), intern(&feat[..feat.len()-1])))
}
}
}