[tbb-commits] [tor-browser] 21/76: Bug 1758021 - Get is_{arm, aarch64}_feature_detected from std::arch on rustc >= 1.60. r=jrmuizel, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:39:49 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit 2e6e53cb3a6a8d112bf69f57f9ad0a270cefe730
Author: Mike Hommey <mh+mozilla at glandium.org>
AuthorDate: Fri Mar 4 00:39:40 2022 +0000

    Bug 1758021 - Get is_{arm,aarch64}_feature_detected from std::arch on rustc >= 1.60. r=jrmuizel, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D140278
---
 Cargo.lock                | 1 +
 gfx/qcms/Cargo.toml       | 3 +++
 gfx/qcms/build.rs         | 5 +++++
 gfx/qcms/src/gtest.rs     | 4 ++++
 gfx/qcms/src/transform.rs | 4 ++++
 5 files changed, 17 insertions(+)

diff --git a/Cargo.lock b/Cargo.lock
index de958a6fe2ed9..56122da06357a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3888,6 +3888,7 @@ name = "qcms"
 version = "0.2.0"
 dependencies = [
  "libc",
+ "rustc_version",
 ]
 
 [[package]]
diff --git a/gfx/qcms/Cargo.toml b/gfx/qcms/Cargo.toml
index e976054a7b32a..1b87ea48191bd 100644
--- a/gfx/qcms/Cargo.toml
+++ b/gfx/qcms/Cargo.toml
@@ -20,3 +20,6 @@ cmyk = []
 
 [dependencies]
 libc = {version = "0.2", optional = true }
+
+[build-dependencies]
+rustc_version = "0.2"
diff --git a/gfx/qcms/build.rs b/gfx/qcms/build.rs
index 578c6a6f3e553..69e40748cc92d 100644
--- a/gfx/qcms/build.rs
+++ b/gfx/qcms/build.rs
@@ -1,3 +1,5 @@
+use rustc_version::{version, Version};
+
 fn main() {
     if cfg!(feature = "neon") {
         if std::env::var_os("RUSTC_BOOTSTRAP").is_none() {
@@ -11,4 +13,7 @@ fn main() {
     if target.contains("neon") {
         println!("cargo:rustc-cfg=libcore_neon");
     }
+    if version().unwrap() >= Version::parse("1.60.0-alpha").unwrap() {
+        println!("cargo:rustc-cfg=std_arch");
+    }
 }
diff --git a/gfx/qcms/src/gtest.rs b/gfx/qcms/src/gtest.rs
index d64d76aa40351..374f1a9c22b20 100644
--- a/gfx/qcms/src/gtest.rs
+++ b/gfx/qcms/src/gtest.rs
@@ -5,6 +5,10 @@ mod gtest {
         transform_util::lut_inverse_interp16, Intent::Perceptual,
     };
     use libc::c_void;
+    #[cfg(all(target_arch = "arm", std_arch))]
+    use std::arch::is_arm_feature_detected;
+    #[cfg(all(target_arch = "aarch64", std_arch))]
+    use std::arch::is_aarch64_feature_detected;
     use std::ptr::null_mut;
 
     #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
diff --git a/gfx/qcms/src/transform.rs b/gfx/qcms/src/transform.rs
index f3d9e8b4c4cdc..b688f6c77f15a 100644
--- a/gfx/qcms/src/transform.rs
+++ b/gfx/qcms/src/transform.rs
@@ -55,6 +55,10 @@ use crate::{
 
 use std::sync::atomic::Ordering;
 use std::sync::Arc;
+#[cfg(all(target_arch = "arm", feature = "neon", std_arch))]
+use std::arch::is_arm_feature_detected;
+#[cfg(all(target_arch = "aarch64", feature = "neon", std_arch))]
+use std::arch::is_aarch64_feature_detected;
 
 pub const PRECACHE_OUTPUT_SIZE: usize = 8192;
 pub const PRECACHE_OUTPUT_MAX: usize = PRECACHE_OUTPUT_SIZE - 1;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list