Skip to content

Commit f4e7fde

Browse files
Flatmap features before comparing to LLVM
1 parent 01a4471 commit f4e7fde

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,11 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
237237
.filter_map(|&(feature, gate)| {
238238
if sess.is_nightly_build() || gate.is_none() { Some(feature) } else { None }
239239
})
240+
.flat_map(|feature| to_llvm_features(sess, feature))
240241
.filter(|feature| {
241-
for llvm_feature in to_llvm_features(sess, feature) {
242-
let cstr = SmallCStr::new(llvm_feature);
243-
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
244-
return true;
245-
}
242+
let cstr = SmallCStr::new(feature);
243+
if unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) } {
244+
return true;
246245
}
247246
false
248247
})

0 commit comments

Comments
 (0)