]> git.proxmox.com Git - rustc.git/blob - src/test/rustdoc/doc-cfg.rs
Merge branch 'debian/sid' into debian/experimental
[rustc.git] / src / test / rustdoc / doc-cfg.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(doc_cfg)]
12
13 // @has doc_cfg/struct.Portable.html
14 // @!has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' ''
15 // @has - '//*[@id="method.unix_and_arm_only_function"]' 'fn unix_and_arm_only_function()'
16 // @has - '//*[@class="stab portability"]' 'This is supported on Unix and ARM only.'
17 pub struct Portable;
18
19 // @has doc_cfg/unix_only/index.html \
20 // '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
21 // 'This is supported on Unix only.'
22 // @matches - '//*[@class=" module-item"]//*[@class="stab portability"]' '\AUnix\Z'
23 // @matches - '//*[@class=" module-item"]//*[@class="stab portability"]' '\AUnix and ARM\Z'
24 // @count - '//*[@class="stab portability"]' 3
25 #[doc(cfg(unix))]
26 pub mod unix_only {
27 // @has doc_cfg/unix_only/fn.unix_only_function.html \
28 // '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
29 // 'This is supported on Unix only.'
30 // @count - '//*[@class="stab portability"]' 1
31 pub fn unix_only_function() {
32 content::should::be::irrelevant();
33 }
34
35 // @has doc_cfg/unix_only/trait.ArmOnly.html \
36 // '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
37 // 'This is supported on Unix and ARM only.'
38 // @count - '//*[@class="stab portability"]' 2
39 #[doc(cfg(target_arch = "arm"))]
40 pub trait ArmOnly {
41 fn unix_and_arm_only_function();
42 }
43
44 impl ArmOnly for super::Portable {
45 fn unix_and_arm_only_function() {}
46 }
47 }