Skip to content

Commit b249029

Browse files
committed
Check for feature with pre-interned symbol
1 parent 94cd4f1 commit b249029

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/librustc_codegen_llvm/builder.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_data_structures::small_c_str::SmallCStr;
1818
use rustc_hir::def_id::DefId;
1919
use rustc_middle::ty::layout::TyAndLayout;
2020
use rustc_middle::ty::{self, Ty, TyCtxt};
21+
use rustc_span::sym;
2122
use rustc_target::abi::{self, Align, Size};
2223
use rustc_target::spec::{HasTargetSpec, Target};
2324
use std::borrow::Cow;
@@ -478,7 +479,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
478479
let llptr = self.struct_gep(place.llval, i as u64);
479480
let load = self.load(llptr, align);
480481
scalar_load_metadata(self, load, scalar);
481-
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
482+
if scalar.is_bool() {
483+
self.trunc(load, self.type_i1())
484+
} else {
485+
load
486+
}
482487
};
483488

484489
OperandValue::Pair(
@@ -654,10 +659,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
654659

655660
fn fptoui_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
656661
if self.sess().target.target.arch == "wasm32"
657-
&& self
658-
.sess()
659-
.target_features
660-
.contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint"))
662+
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
661663
{
662664
let src_ty = self.cx.val_ty(val);
663665
let float_width = self.cx.float_width(src_ty);
@@ -679,10 +681,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
679681

680682
fn fptosi_sat(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> Option<&'ll Value> {
681683
if self.sess().target.target.arch == "wasm32"
682-
&& self
683-
.sess()
684-
.target_features
685-
.contains(&rustc_span::symbol::Symbol::intern("nontrapping-fptoint"))
684+
&& self.sess().target_features.contains(&sym::wasm_nontrapping_fptoint)
686685
{
687686
let src_ty = self.cx.val_ty(val);
688687
let float_width = self.cx.float_width(src_ty);

src/librustc_codegen_llvm/llvm_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const RISCV_WHITELIST: &[(&str, Option<Symbol>)] = &[
253253
const WASM_WHITELIST: &[(&str, Option<Symbol>)] = &[
254254
("simd128", Some(sym::wasm_target_feature)),
255255
("atomics", Some(sym::wasm_target_feature)),
256-
("nontrapping-fptoint", Some(sym::wasm_target_feature)), // TODO: Maybe None?
256+
("nontrapping-fptoint", Some(sym::wasm_target_feature)),
257257
];
258258

259259
/// When rustdoc is running, provide a list of all known features so that all their respective

src/librustc_span/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ symbols! {
844844
warn,
845845
wasm_import_module,
846846
wasm_target_feature,
847+
wasm_nontrapping_fptoint: "nontrapping-fptoint",
847848
while_let,
848849
windows,
849850
windows_subsystem,

0 commit comments

Comments
 (0)