Skip to content

Commit f942c28

Browse files
committed
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.
1 parent 3fc5d27 commit f942c28

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_driver/target_features.rs

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

0 commit comments

Comments
 (0)