diff --git a/crates/spirv-std/src/scalar.rs b/crates/spirv-std/src/scalar.rs index 72e0d8dfaf..bff86b6964 100644 --- a/crates/spirv-std/src/scalar.rs +++ b/crates/spirv-std/src/scalar.rs @@ -8,10 +8,7 @@ use core::num::NonZeroUsize; /// # Safety /// Implementing this trait on non-scalar types breaks assumptions of other unsafe code, and should /// not be done. -pub unsafe trait Scalar: - VectorOrScalar + Copy + Default + crate::sealed::Sealed -{ -} +pub unsafe trait Scalar: VectorOrScalar + crate::sealed::Sealed {} macro_rules! impl_scalar { ($($ty:ty),+) => { diff --git a/crates/spirv-std/src/vector.rs b/crates/spirv-std/src/vector.rs index 668f40bd32..0385db83ac 100644 --- a/crates/spirv-std/src/vector.rs +++ b/crates/spirv-std/src/vector.rs @@ -9,7 +9,7 @@ use glam::{Vec3Swizzles, Vec4Swizzles}; /// # Safety /// Implementing this trait on non-scalar or non-vector types may break assumptions about other /// unsafe code, and should not be done. -pub unsafe trait VectorOrScalar: Default { +pub unsafe trait VectorOrScalar: Copy + Default + Send + Sync + 'static { /// Either the scalar component type of the vector or the scalar itself. type Scalar: Scalar; diff --git a/tests/ui/arch/all.rs b/tests/ui/arch/all.rs index 18967b0d87..088e07f0a5 100644 --- a/tests/ui/arch/all.rs +++ b/tests/ui/arch/all.rs @@ -12,6 +12,7 @@ use spirv_std::{scalar::Scalar, vector::Vector, vector::VectorOrScalar}; /// Fortunately, this requirement isn't checked on generic structs, so we have a way to work around /// it (for now at least) #[repr(simd)] +#[derive(Copy, Clone, Debug)] struct Vec2(T, T); unsafe impl VectorOrScalar for Vec2 { type Scalar = T; diff --git a/tests/ui/arch/all.stderr b/tests/ui/arch/all.stderr index 8226745fbd..beed8baf22 100644 --- a/tests/ui/arch/all.stderr +++ b/tests/ui/arch/all.stderr @@ -1,7 +1,7 @@ warning: [Rust-GPU] temporarily re-allowing old-style `#[repr(simd)]` (with fields) - --> $DIR/all.rs:15:1 + --> $DIR/all.rs:16:1 | -15 | struct Vec2(T, T); +16 | struct Vec2(T, T); | ^^^^^^^^^^^^^^ | = note: removed upstream by https://github.com/rust-lang/rust/pull/129403 diff --git a/tests/ui/arch/any.rs b/tests/ui/arch/any.rs index 7d03403c77..9e8e1d2f3f 100644 --- a/tests/ui/arch/any.rs +++ b/tests/ui/arch/any.rs @@ -12,6 +12,7 @@ use spirv_std::{scalar::Scalar, vector::Vector, vector::VectorOrScalar}; /// Fortunately, this requirement isn't checked on generic structs, so we have a way to work around /// it (for now at least) #[repr(simd)] +#[derive(Copy, Clone, Debug)] struct Vec2(T, T); unsafe impl VectorOrScalar for Vec2 { type Scalar = T; diff --git a/tests/ui/arch/any.stderr b/tests/ui/arch/any.stderr index ff776148f5..c01af8f3ba 100644 --- a/tests/ui/arch/any.stderr +++ b/tests/ui/arch/any.stderr @@ -1,7 +1,7 @@ warning: [Rust-GPU] temporarily re-allowing old-style `#[repr(simd)]` (with fields) - --> $DIR/any.rs:15:1 + --> $DIR/any.rs:16:1 | -15 | struct Vec2(T, T); +16 | struct Vec2(T, T); | ^^^^^^^^^^^^^^ | = note: removed upstream by https://github.com/rust-lang/rust/pull/129403