diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 868ce876a8192..54271d3dd0491 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -23,6 +23,7 @@ use rustc_middle::bug; use rustc_middle::ty::TyCtxt; use rustc_session::config::{self, Lto, OutputType, Passes, SanitizerSet, SwitchWithOptPath}; use rustc_session::Session; +use rustc_span::symbol::sym; use rustc_span::InnerSpan; use rustc_target::spec::{CodeModel, RelocModel}; @@ -140,7 +141,7 @@ pub fn target_machine_factory( // lower atomic operations to single-threaded operations. if singlethread && sess.target.target.llvm_target.contains("wasm32") - && features.iter().any(|s| *s == "+atomics") + && sess.target_features.contains(&sym::atomics) { singlethread = false; } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 6011d422ca682..d6ef94bfd1727 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -1,6 +1,7 @@ use super::archive; use super::command::Command; use super::symbol_export; +use rustc_span::symbol::sym; use std::ffi::{OsStr, OsString}; use std::fs::{self, File}; @@ -1036,9 +1037,7 @@ impl<'a> WasmLd<'a> { // // * `--export=*tls*` - when `#[thread_local]` symbols are used these // symbols are how the TLS segments are initialized and configured. - let atomics = sess.opts.cg.target_feature.contains("+atomics") - || sess.target.target.options.features.contains("+atomics"); - if atomics { + if sess.target_features.contains(&sym::atomics) { cmd.arg("--shared-memory"); cmd.arg("--max-memory=1073741824"); cmd.arg("--import-memory"); diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index 5b1bafe3955cc..fa1368b104c7e 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -159,6 +159,7 @@ symbols! { assume_init, async_await, async_closure, + atomics, attr, attributes, attr_literals,