This is an automated email from the ASF dual-hosted git repository.

dingyu pushed a commit to branch newer-compiler-11-26
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git

commit 7535df61719f63dcfcbedf3d515499a72a544e71
Author: Yu Ding <[email protected]>
AuthorDate: Thu Nov 26 20:55:26 2020 -0800

    compiler: support rustc >= 2020-11-26
---
 sgx_tstd/Cargo.toml | 3 +++
 sgx_tstd/build.rs   | 7 +++++++
 sgx_tstd/src/lib.rs | 5 +++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/sgx_tstd/Cargo.toml b/sgx_tstd/Cargo.toml
index cb42c1b..5dfe6fd 100644
--- a/sgx_tstd/Cargo.toml
+++ b/sgx_tstd/Cargo.toml
@@ -38,3 +38,6 @@ package = "hashbrown_tstd"
 path = "./hashbrown"
 default-features = false
 features = ['rustc-dep-of-std']
+
+[build-dependencies]
+version_check = "0.9"
diff --git a/sgx_tstd/build.rs b/sgx_tstd/build.rs
index 08a9d10..b29efc6 100644
--- a/sgx_tstd/build.rs
+++ b/sgx_tstd/build.rs
@@ -32,4 +32,11 @@ fn main() {
         println!("cargo:rustc-link-search=native={}/lib64", sdk_dir);
         println!("cargo:rustc-link-lib=static=sgx_pthread");
     }
+
+    // since nightly-2020-11-26 (rustc 2020-11-25), auto_traits replaced
+    // optin_builtin_traits
+    // see 
https://github.com/rust-lang/rust/commit/810324d1f31eb8d75e8f0044df720652986ef133
+    if let Some(true) = version_check::is_min_date("2020-11-25") {
+        println!("cargo:rustc-cfg=enable_auto_traits");
+    }
 }
diff --git a/sgx_tstd/src/lib.rs b/sgx_tstd/src/lib.rs
index 74d1ca7..9769cea 100644
--- a/sgx_tstd/src/lib.rs
+++ b/sgx_tstd/src/lib.rs
@@ -42,13 +42,14 @@
 #![allow(unused_assignments)]
 
 #![feature(alloc_error_handler)]
-#![feature(panic_unwind)]
 #![feature(allocator_api)]
 #![feature(allow_internal_unsafe)]
 #![feature(allocator_internals)]
 #![feature(allow_internal_unstable)]
 #![feature(array_error_internals)]
 #![feature(asm)]
+#![cfg_attr(enable_auto_traits, feature(auto_traits))]
+#![cfg_attr(not(enable_auto_traits), feature(optin_builtin_traits))]
 #![feature(box_syntax)]
 #![feature(c_variadic)]
 #![feature(cfg_accessible)]
@@ -74,7 +75,7 @@
 #![feature(maybe_uninit_ref)]
 #![feature(never_type)]
 #![feature(needs_panic_runtime)]
-#![feature(optin_builtin_traits)]
+#![feature(panic_unwind)]
 #![feature(prelude_import)]
 #![feature(ptr_internals)]
 #![feature(raw)]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to