-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Make cfg imply doc(cfg) #79341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cfg imply doc(cfg) #79341
Changes from 1 commit
85ec783
74d0d3f
e0c438f
28500e7
0225d97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,7 @@ impl Clean<Item> for doctree::Module<'_> { | |
impl Clean<Attributes> for [ast::Attribute] { | ||
fn clean(&self, cx: &mut DocContext<'_>) -> Attributes { | ||
let doc_cfg_active = cx.tcx.features().doc_cfg; | ||
Attributes::from_ast(cx.sess().diagnostic(), self, None, doc_cfg_active) | ||
Attributes::from_ast(cx.sess().diagnostic(), self, None, doc_cfg_active, &cx.hidden_cfg) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why put this on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found why - you use it directly in |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#![crate_name = "oud"] | ||
#![feature(doc_cfg, doc_cfg_hide)] | ||
|
||
#![doc(cfg_hide(feature = "solecism"))] | ||
|
||
// @has 'oud/struct.Solecism.html' | ||
// @count - '//*[@class="stab portability"]' 0 | ||
// compile-flags:--cfg feature="solecism" | ||
#[cfg(feature = "solecism")] | ||
pub struct Solecism; | ||
|
||
// @has 'oud/struct.Scribacious.html' | ||
// @count - '//*[@class="stab portability"]' 1 | ||
// @matches - '//*[@class="stab portability"]' 'crate feature solecism' | ||
#[cfg(feature = "solecism")] | ||
#[doc(cfg(feature = "solecism"))] | ||
pub struct Scribacious; | ||
|
||
// @has 'oud/struct.Hyperdulia.html' | ||
// @count - '//*[@class="stab portability"]' 1 | ||
// @matches - '//*[@class="stab portability"]' 'crate feature hyperdulia' | ||
// compile-flags:--cfg feature="hyperdulia" | ||
#[cfg(feature = "solecism")] | ||
#[cfg(feature = "hyperdulia")] | ||
pub struct Hyperdulia; | ||
|
||
// @has 'oud/struct.Oystercatcher.html' | ||
// @count - '//*[@class="stab portability"]' 1 | ||
// @matches - '//*[@class="stab portability"]' 'crate features solecism and oystercatcher' | ||
// compile-flags:--cfg feature="oystercatcher" | ||
#[cfg(all(feature = "solecism", feature = "oystercatcher"))] | ||
pub struct Oystercatcher; |
Uh oh!
There was an error while loading. Please reload this page.