diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-06-03 20:19:44 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-03 20:19:44 +0800 |
| commit | 033b829e0a5b33f0b383a3711b7635a7464cd6fc (patch) | |
| tree | 6c3a4faecdcff30608e6efd6a41b3b5fcc900aa0 /compiler/rustc_data_structures/src | |
| parent | 10f2bcc95738423fbdf01ce3bb00e4092102c438 (diff) | |
| parent | b65ceb28e0cc639e3adc9d93b11ecc3228fac4c2 (diff) | |
| download | rust-033b829e0a5b33f0b383a3711b7635a7464cd6fc.tar.gz rust-033b829e0a5b33f0b383a3711b7635a7464cd6fc.zip | |
Merge pull request #2451 from jieyouxu/rustc-pull
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/flock.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/lib.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/profiling.rs | 13 |
3 files changed, 26 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/flock.rs b/compiler/rustc_data_structures/src/flock.rs index f33f6b7cac1..60ae7ad115a 100644 --- a/compiler/rustc_data_structures/src/flock.rs +++ b/compiler/rustc_data_structures/src/flock.rs @@ -4,7 +4,18 @@ //! green/native threading. This is just a bare-bones enough solution for //! librustdoc, it is not production quality at all. -cfg_select! { +// cfg(bootstrap) +macro_rules! cfg_select_dispatch { + ($($tokens:tt)*) => { + #[cfg(bootstrap)] + cfg_match! { $($tokens)* } + + #[cfg(not(bootstrap))] + cfg_select! { $($tokens)* } + }; +} + +cfg_select_dispatch! { target_os = "linux" => { mod linux; use linux as imp; diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs index b34a7fdb9e4..b7447e24731 100644 --- a/compiler/rustc_data_structures/src/lib.rs +++ b/compiler/rustc_data_structures/src/lib.rs @@ -10,6 +10,8 @@ #![allow(internal_features)] #![allow(rustc::default_hash_types)] #![allow(rustc::potential_query_instability)] +#![cfg_attr(bootstrap, feature(cfg_match))] +#![cfg_attr(not(bootstrap), feature(cfg_select))] #![deny(unsafe_op_in_unsafe_fn)] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(rust_logo)] @@ -19,7 +21,6 @@ #![feature(ascii_char_variants)] #![feature(assert_matches)] #![feature(auto_traits)] -#![feature(cfg_select)] #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![feature(extend_one)] diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 36649a36070..e3a01e4035c 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -859,8 +859,19 @@ fn get_thread_id() -> u32 { std::thread::current().id().as_u64().get() as u32 } +// cfg(bootstrap) +macro_rules! cfg_select_dispatch { + ($($tokens:tt)*) => { + #[cfg(bootstrap)] + cfg_match! { $($tokens)* } + + #[cfg(not(bootstrap))] + cfg_select! { $($tokens)* } + }; +} + // Memory reporting -cfg_select! { +cfg_select_dispatch! { windows => { pub fn get_resident_set_size() -> Option<usize> { use windows::{ |
