2017-08-05 14:38:52 +08:00
|
|
|
#![feature(doc_cfg)]
|
2018-03-21 19:57:10 -05:00
|
|
|
#![feature(target_feature, cfg_target_feature)]
|
2017-08-05 14:38:52 +08:00
|
|
|
|
|
|
|
// @has doc_cfg/struct.Portable.html
|
2020-11-23 13:20:16 +01:00
|
|
|
// @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' ''
|
2017-08-05 14:38:52 +08:00
|
|
|
// @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
|
|
|
|
// @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
|
|
|
|
pub struct Portable;
|
|
|
|
|
|
|
|
// @has doc_cfg/unix_only/index.html \
|
2020-11-23 13:20:16 +01:00
|
|
|
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
|
2017-08-05 14:38:52 +08:00
|
|
|
// 'This is supported on Unix only.'
|
2020-10-06 20:48:01 +02:00
|
|
|
// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AARM\Z'
|
|
|
|
// @count - '//*[@class="stab portability"]' 2
|
2017-08-05 14:38:52 +08:00
|
|
|
#[doc(cfg(unix))]
|
|
|
|
pub mod unix_only {
|
|
|
|
// @has doc_cfg/unix_only/fn.unix_only_function.html \
|
2020-11-23 13:20:16 +01:00
|
|
|
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
|
2017-08-05 14:38:52 +08:00
|
|
|
// 'This is supported on Unix only.'
|
|
|
|
// @count - '//*[@class="stab portability"]' 1
|
|
|
|
pub fn unix_only_function() {
|
|
|
|
content::should::be::irrelevant();
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has doc_cfg/unix_only/trait.ArmOnly.html \
|
2020-11-23 13:20:16 +01:00
|
|
|
// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
|
2017-08-05 14:38:52 +08:00
|
|
|
// 'This is supported on Unix and ARM only.'
|
2020-11-23 13:22:56 +01:00
|
|
|
// @count - '//*[@class="stab portability"]' 1
|
2017-08-05 14:38:52 +08:00
|
|
|
#[doc(cfg(target_arch = "arm"))]
|
|
|
|
pub trait ArmOnly {
|
|
|
|
fn unix_and_arm_only_function();
|
|
|
|
}
|
|
|
|
|
2020-11-23 13:22:56 +01:00
|
|
|
#[doc(cfg(target_arch = "arm"))]
|
2017-08-05 14:38:52 +08:00
|
|
|
impl ArmOnly for super::Portable {
|
|
|
|
fn unix_and_arm_only_function() {}
|
|
|
|
}
|
2017-12-30 02:25:40 +08:00
|
|
|
}
|
2018-03-21 19:57:10 -05:00
|
|
|
|
|
|
|
// tagging a function with `#[target_feature]` creates a doc(cfg(target_feature)) node for that
|
|
|
|
// item as well
|
|
|
|
|
|
|
|
// the portability header is different on the module view versus the full view
|
|
|
|
// @has doc_cfg/index.html
|
2018-10-16 20:21:34 +02:00
|
|
|
// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\Aavx\Z'
|
2018-03-21 19:57:10 -05:00
|
|
|
|
|
|
|
// @has doc_cfg/fn.uses_target_feature.html
|
2020-11-23 13:20:16 +01:00
|
|
|
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
|
2018-03-21 19:57:10 -05:00
|
|
|
// 'This is supported with target feature avx only.'
|
|
|
|
#[target_feature(enable = "avx")]
|
|
|
|
pub unsafe fn uses_target_feature() {
|
|
|
|
content::should::be::irrelevant();
|
|
|
|
}
|
|
|
|
|
|
|
|
// @has doc_cfg/fn.uses_cfg_target_feature.html
|
2020-11-23 13:20:16 +01:00
|
|
|
// @has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \
|
2018-03-21 19:57:10 -05:00
|
|
|
// 'This is supported with target feature avx only.'
|
|
|
|
#[doc(cfg(target_feature = "avx"))]
|
|
|
|
pub fn uses_cfg_target_feature() {
|
|
|
|
uses_target_feature();
|
|
|
|
}
|