From 8b6c34ee9b00163fcd92e91bd724efcc92f555bb Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Mon, 6 Jul 2026 20:48:52 -0700 Subject: [PATCH] Always `extern crate std` when `cfg(test)`. (#9817) --- naga-types/src/lib.rs | 2 +- wgpu-core/src/lib.rs | 2 +- wgpu-hal/src/lib.rs | 2 +- wgpu-types/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/naga-types/src/lib.rs b/naga-types/src/lib.rs index fcf5f686a..72b58a4c2 100644 --- a/naga-types/src/lib.rs +++ b/naga-types/src/lib.rs @@ -1,7 +1,7 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![no_std] extern crate alloc; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", test))] extern crate std; pub mod glsl; diff --git a/wgpu-core/src/lib.rs b/wgpu-core/src/lib.rs index 212aeff77..ca49aa2ee 100644 --- a/wgpu-core/src/lib.rs +++ b/wgpu-core/src/lib.rs @@ -64,7 +64,7 @@ extern crate alloc; extern crate naga_types as nt; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", test))] extern crate std; extern crate wgpu_hal as hal; extern crate wgpu_types as wgt; diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index ca626f275..d4bfc287c 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -243,7 +243,7 @@ extern crate alloc; extern crate naga_types as nt; extern crate wgpu_types as wgt; // Each of these backends needs `std` in some fashion; usually `std::thread` functions. -#[cfg(any(dx12, gles_with_std, metal, vulkan))] +#[cfg(any(dx12, gles_with_std, metal, vulkan, test))] #[macro_use] extern crate std; diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index e5ce86c41..5b4b097be 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -14,7 +14,7 @@ )] #![no_std] -#[cfg(feature = "std")] +#[cfg(any(feature = "std", test))] extern crate std; extern crate alloc;