Skip to content

Commit

Permalink
Add sgx_tstd::prelude::{rust_2015,rust_2018,rust_2010}
Browse files Browse the repository at this point in the history
  • Loading branch information
volcano0dr committed Apr 1, 2021
1 parent 4ce4088 commit e8fa0d3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sgx_tstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ fn main() {
if let Some(true) = is_min_date("2021-02-07") {
println!("cargo:rustc-cfg=derive_macros");
}

// nightly-2021-03-11 (rustc 2021-03-10)
// https://github.com/rust-lang/rust/commit/1ab9fe5d44860050232438967bbbf9bdc35dbde1
if let Some(true) = is_min_date("2021-03-10") {
println!("cargo:rustc-cfg=enable_prelude_version");
}
}

// code below copied from crate version_check
Expand Down
1 change: 1 addition & 0 deletions sgx_tstd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#![feature(needs_panic_runtime)]
#![feature(once_cell)]
#![feature(panic_unwind)]
#![cfg_attr(enable_prelude_version, feature(prelude_2021))]
#![feature(prelude_import)]
#![feature(ptr_internals)]
#![feature(raw)]
Expand Down
30 changes: 30 additions & 0 deletions sgx_tstd/src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,33 @@
//! On a technical level, Rust inserts
//!
pub mod v1;

/// The 2015 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[cfg(enable_prelude_version)]
pub mod rust_2015 {
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2018 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[cfg(enable_prelude_version)]
pub mod rust_2018 {
#[doc(no_inline)]
pub use super::v1::*;
}

/// The 2021 version of the prelude of The Rust Standard Library.
///
/// See the [module-level documentation](self) for more.
#[cfg(enable_prelude_version)]
pub mod rust_2021 {
#[doc(no_inline)]
pub use super::v1::*;

#[doc(no_inline)]
pub use core::prelude::rust_2021::*;
}
6 changes: 6 additions & 0 deletions xargo/sgx_tstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ fn main() {
if let Some(true) = is_min_date("2021-02-07") {
println!("cargo:rustc-cfg=derive_macros");
}

// nightly-2021-03-11 (rustc 2021-03-10)
// https://github.com/rust-lang/rust/commit/1ab9fe5d44860050232438967bbbf9bdc35dbde1
if let Some(true) = is_min_date("2021-03-10") {
println!("cargo:rustc-cfg=enable_prelude_version");
}
}

// code below copied from crate version_check
Expand Down

0 comments on commit e8fa0d3

Please sign in to comment.