|
5 | 5 | // @!has - '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' ''
|
6 | 6 | // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
|
7 | 7 | // @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
|
| 8 | +// @has - '//*[@id="method.wasi_and_wasm32_only_function"]' 'fn wasi_and_wasm32_only_function()' |
| 9 | +// @has - '//*[@class="stab portability"]' 'This is supported on WASI and WebAssembly only.' |
8 | 10 | pub struct Portable;
|
9 | 11 |
|
10 | 12 | // @has doc_cfg/unix_only/index.html \
|
@@ -37,6 +39,36 @@ pub mod unix_only {
|
37 | 39 | }
|
38 | 40 | }
|
39 | 41 |
|
| 42 | +// @has doc_cfg/wasi_only/index.html \ |
| 43 | +// '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ |
| 44 | +// 'This is supported on WASI only.' |
| 45 | +// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AWebAssembly\Z' |
| 46 | +// @count - '//*[@class="stab portability"]' 2 |
| 47 | +#[doc(cfg(target_os = "wasi"))] |
| 48 | +pub mod wasi_only { |
| 49 | + // @has doc_cfg/wasi_only/fn.wasi_only_function.html \ |
| 50 | + // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ |
| 51 | + // 'This is supported on WASI only.' |
| 52 | + // @count - '//*[@class="stab portability"]' 1 |
| 53 | + pub fn wasi_only_function() { |
| 54 | + content::should::be::irrelevant(); |
| 55 | + } |
| 56 | + |
| 57 | + // @has doc_cfg/wasi_only/trait.Wasm32Only.html \ |
| 58 | + // '//*[@id="main"]/*[@class="item-info"]/*[@class="stab portability"]' \ |
| 59 | + // 'This is supported on WASI and WebAssembly only.' |
| 60 | + // @count - '//*[@class="stab portability"]' 1 |
| 61 | + #[doc(cfg(target_arch = "wasm32"))] |
| 62 | + pub trait Wasm32Only { |
| 63 | + fn wasi_and_wasm32_only_function(); |
| 64 | + } |
| 65 | + |
| 66 | + #[doc(cfg(target_arch = "wasm32"))] |
| 67 | + impl Wasm32Only for super::Portable { |
| 68 | + fn wasi_and_wasm32_only_function() {} |
| 69 | + } |
| 70 | +} |
| 71 | + |
40 | 72 | // tagging a function with `#[target_feature]` creates a doc(cfg(target_feature)) node for that
|
41 | 73 | // item as well
|
42 | 74 |
|
|
0 commit comments