diff options
| author | kennytm <kennytm@gmail.com> | 2017-08-05 14:38:52 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-08-10 13:43:59 +0800 |
| commit | a2b888675accccedec7601cc3bd67ca028b4757c (patch) | |
| tree | a13d255f58f1e86112774af9e8c297871adf5834 /src/libsyntax | |
| parent | 8f935fbb5b7e8ea5a320082cb9e28095aa0b5759 (diff) | |
| download | rust-a2b888675accccedec7601cc3bd67ca028b4757c.tar.gz rust-a2b888675accccedec7601cc3bd67ca028b4757c.zip | |
Implemented #[doc(cfg(...))].
This attribute has two effects: 1. Items with this attribute and their children will have the "This is supported on **** only" message attached in the documentation. 2. The items' doc tests will be skipped if the configuration does not match.
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 aeb574bc3af..668732e6855 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -364,6 +364,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! ( @@ -1157,6 +1160,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 } |
