diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 725c144257c4c..6d2ab0e5f5a80 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -732,11 +732,6 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { // Can't be caught in typeck if the array length is generic. if e_len == 0 { tcx.sess.fatal(&format!("monomorphising SIMD type `{}` of zero length", ty)); - } else if !e_len.is_power_of_two() { - tcx.sess.fatal(&format!( - "monomorphising SIMD type `{}` of non-power-of-two length", - ty - )); } else if e_len > MAX_SIMD_LANES { tcx.sess.fatal(&format!( "monomorphising SIMD type `{}` of length greater than {}", diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 5d7f5bf1c7b80..0010d59f710cd 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -1161,15 +1161,6 @@ pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) { if len == 0 { struct_span_err!(tcx.sess, sp, E0075, "SIMD vector cannot be empty").emit(); return; - } else if !len.is_power_of_two() { - struct_span_err!( - tcx.sess, - sp, - E0075, - "SIMD vector length must be a power of two" - ) - .emit(); - return; } else if len > MAX_SIMD_LANES { struct_span_err!( tcx.sess, diff --git a/src/test/ui/simd/issue-17170.rs b/src/test/ui/simd/issue-17170.rs index 49cfbab9a3e6f..8d70dacdc9010 100644 --- a/src/test/ui/simd/issue-17170.rs +++ b/src/test/ui/simd/issue-17170.rs @@ -1,8 +1,8 @@ +// run-pass #![feature(repr_simd)] #[repr(simd)] struct T(f64, f64, f64); -//~^ ERROR SIMD vector length must be a power of two static X: T = T(0.0, 0.0, 0.0); diff --git a/src/test/ui/simd/issue-17170.stderr b/src/test/ui/simd/issue-17170.stderr deleted file mode 100644 index b35c3c4dc980d..0000000000000 --- a/src/test/ui/simd/issue-17170.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0075]: SIMD vector length must be a power of two - --> $DIR/issue-17170.rs:4:1 - | -LL | struct T(f64, f64, f64); - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error: monomorphising SIMD type `T` of non-power-of-two length - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0075`. diff --git a/src/test/ui/simd/issue-39720.rs b/src/test/ui/simd/issue-39720.rs index 7d5969265121c..8cf841f937121 100644 --- a/src/test/ui/simd/issue-39720.rs +++ b/src/test/ui/simd/issue-39720.rs @@ -1,3 +1,4 @@ +// run-pass // ignore-emscripten FIXME(#45351) #![feature(repr_simd, platform_intrinsics)] @@ -5,12 +6,10 @@ #[repr(simd)] #[derive(Copy, Clone, Debug)] pub struct Char3(pub i8, pub i8, pub i8); -//~^ ERROR SIMD vector length must be a power of two #[repr(simd)] #[derive(Copy, Clone, Debug)] pub struct Short3(pub i16, pub i16, pub i16); -//~^ ERROR SIMD vector length must be a power of two extern "platform-intrinsic" { fn simd_cast(x: T) -> U; diff --git a/src/test/ui/simd/issue-39720.stderr b/src/test/ui/simd/issue-39720.stderr deleted file mode 100644 index 355ceff00508a..0000000000000 --- a/src/test/ui/simd/issue-39720.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0075]: SIMD vector length must be a power of two - --> $DIR/issue-39720.rs:7:1 - | -LL | pub struct Char3(pub i8, pub i8, pub i8); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0075]: SIMD vector length must be a power of two - --> $DIR/issue-39720.rs:12:1 - | -LL | pub struct Short3(pub i16, pub i16, pub i16); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0075`. diff --git a/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.rs b/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.rs index 3a0b9e02663d8..9b645d363e932 100644 --- a/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.rs +++ b/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.rs @@ -1,9 +1,7 @@ -// build-fail +// run-pass #![feature(repr_simd, platform_intrinsics)] -// error-pattern:monomorphising SIMD type `Simd<3_usize>` of non-power-of-two length - #[repr(simd)] struct Simd([f32; N]); diff --git a/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.stderr b/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.stderr deleted file mode 100644 index 82cc0d8714aba..0000000000000 --- a/src/test/ui/simd/simd-type-generic-monomorphisation-power-of-two.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: monomorphising SIMD type `Simd<3_usize>` of non-power-of-two length - -error: aborting due to previous error - diff --git a/src/test/ui/simd/simd-type.rs b/src/test/ui/simd/simd-type.rs index cc7443d04856c..73d032a0c8e55 100644 --- a/src/test/ui/simd/simd-type.rs +++ b/src/test/ui/simd/simd-type.rs @@ -10,7 +10,7 @@ struct empty; //~ ERROR SIMD vector cannot be empty struct empty2([f32; 0]); //~ ERROR SIMD vector cannot be empty #[repr(simd)] -struct pow2([f32; 7]); //~ ERROR SIMD vector length must be a power of two +struct pow2([f32; 7]); #[repr(simd)] struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous diff --git a/src/test/ui/simd/simd-type.stderr b/src/test/ui/simd/simd-type.stderr index 8b15ef05e032b..823f10f5daf20 100644 --- a/src/test/ui/simd/simd-type.stderr +++ b/src/test/ui/simd/simd-type.stderr @@ -10,12 +10,6 @@ error[E0075]: SIMD vector cannot be empty LL | struct empty2([f32; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0075]: SIMD vector length must be a power of two - --> $DIR/simd-type.rs:13:1 - | -LL | struct pow2([f32; 7]); - | ^^^^^^^^^^^^^^^^^^^^^^ - error[E0076]: SIMD vector should be homogeneous --> $DIR/simd-type.rs:16:1 | @@ -40,7 +34,7 @@ error[E0075]: SIMD vector cannot have more than 32768 elements LL | struct TooBig([f32; 65536]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0075, E0076, E0077. For more information about an error, try `rustc --explain E0075`.