2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2016-04-19 18:37:39 +02:00
|
|
|
|
2018-12-09 11:20:20 +01:00
|
|
|
#![allow(stable_features)]
|
2016-04-19 18:37:39 +02:00
|
|
|
#![feature(cfg_target_feature)]
|
|
|
|
|
2017-01-13 16:22:47 -08:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2017-01-19 17:18:12 -08:00
|
|
|
match env::var("TARGET") {
|
|
|
|
Ok(s) => {
|
|
|
|
// Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
|
|
|
|
if s.contains("i586") {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Err(_) => return,
|
2017-01-13 16:22:47 -08:00
|
|
|
}
|
2016-04-19 18:37:39 +02:00
|
|
|
if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
|
|
|
|
assert!(cfg!(target_feature = "sse2"),
|
2017-01-13 16:22:47 -08:00
|
|
|
"SSE2 was not detected as available on an x86 platform");
|
2016-04-19 18:37:39 +02:00
|
|
|
}
|
2024-05-01 16:55:10 -07:00
|
|
|
// check a negative case too -- certainly not enabled by default
|
2024-04-07 00:33:37 +02:00
|
|
|
#[expect(unexpected_cfgs)]
|
|
|
|
{ assert!(cfg!(not(target_feature = "ferris_wheel")),
|
|
|
|
"🎡 shouldn't be detected as available by default on any platform") };
|
2016-04-19 18:37:39 +02:00
|
|
|
}
|