diff options
| author | bors <bors@rust-lang.org> | 2017-08-13 03:00:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-08-13 03:00:20 +0000 |
| commit | 0ed03e5490b481804db27627e16e147680ed207d (patch) | |
| tree | 44a0874cff604868f309f50a2de1e9e13876d816 /src/libsyntax | |
| parent | 14fb329e0a691f04308d0a006d8e744595e8c8dc (diff) | |
| parent | 3093bb85f94e6f3c4707674c8b70c28ecfbf3bf9 (diff) | |
| download | rust-0ed03e5490b481804db27627e16e147680ed207d.tar.gz rust-0ed03e5490b481804db27627e16e147680ed207d.zip | |
Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichton
Expose all OS-specific modules in libstd doc. 1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc. 2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness. 3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed. Fixes #24658 (Does _not_ fully implement #1998).
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 46ee126b9d9..2b8a733b852 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -372,6 +372,9 @@ declare_features! ( // global allocators and their internals (active, global_allocator, "1.20.0", None), (active, allocator_internals, "1.20.0", None), + + // #[doc(cfg(...))] + (active, doc_cfg, "1.21.0", Some(43781)), ); declare_features! ( @@ -1172,6 +1175,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { self.context.check_attribute(attr, false); } + if attr.check_name("doc") { + if let Some(content) = attr.meta_item_list() { + if content.len() == 1 && content[0].check_name("cfg") { + gate_feature_post!(&self, doc_cfg, attr.span, + "#[doc(cfg(...))] is experimental" + ); + } + } + } + if self.context.features.proc_macro && attr::is_known(attr) { return } |
