Skip to content

Commit e3b5328

Browse files
authored
Fix curve25519-dalek-derive test compilation on CentOS 10 x86_64 (#756)
The test assumed that the 'avx2' target_feature would never be set and used this fact to verify that unsafe_target_feature would correctly not even compile test functions maked with that target_feature. As of CentOS 10 and derivatives, th avx2 target_feature is now set by the system rustc, so let's use a target_feature less likely to appear in the real world. Closes #755
1 parent 6762576 commit e3b5328

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

curve25519-dalek-derive/tests/tests.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,15 @@ mod inner_spec {
122122
#[test]
123123
fn test_sse2_only() {}
124124

125-
#[unsafe_target_feature("avx2")]
125+
// it turns out that for compilation to succeed, the feature needs be supported by rustc. For this
126+
// test actually verify what happens when the target_feature is not enabled, this needs to be a
127+
// pretty esoteric feature. Looking at the table of supported avx512 features at
128+
// https://en.wikipedia.org/wiki/AVX-512#CPUs_with_AVX-512 it seems avx512vp2intersect is one of the
129+
// most unusual ones that has rustc knows about
130+
#[unsafe_target_feature("avx512vp2intersect")]
126131
#[test]
127-
fn test_avx2_only() {
128-
compile_error!();
132+
fn test_unset_target_feature() {
133+
compile_error!("When an unknown target_feature is set on a test, unsafe_target_feature is expected remove the function");
129134
}
130135

131136
#[test]

0 commit comments

Comments
 (0)