2019-07-26 21:54:25 +00:00
|
|
|
//@ run-pass
|
2016-04-19 16:37:39 +00:00
|
|
|
|
2018-12-09 10:20:20 +00:00
|
|
|
#![allow(stable_features)]
|
2016-04-19 16:37:39 +00:00
|
|
|
#![feature(cfg_target_feature)]
|
2024-04-06 22:33:37 +00:00
|
|
|
#![feature(lint_reasons)]
|
2016-04-19 16:37:39 +00:00
|
|
|
|
2017-01-14 00:22:47 +00:00
|
|
|
use std::env;
|
|
|
|
|
|
|
|
fn main() {
|
2017-01-20 01:18:12 +00: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-14 00:22:47 +00:00
|
|
|
}
|
2016-04-19 16:37:39 +00:00
|
|
|
if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
|
|
|
|
assert!(cfg!(target_feature = "sse2"),
|
2017-01-14 00:22:47 +00:00
|
|
|
"SSE2 was not detected as available on an x86 platform");
|
2016-04-19 16:37:39 +00:00
|
|
|
}
|
2024-05-01 23:55:10 +00:00
|
|
|
// check a negative case too -- certainly not enabled by default
|
2024-04-06 22:33:37 +00: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 16:37:39 +00:00
|
|
|
}
|