mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Rollup merge of #77672 - Nemo157:simplify-cfg, r=jyn514
Simplify doc-cfg rendering based on the current context For sub-items on a page don't show cfg that has already been rendered on a parent item. At its simplest this means not showing anything that is shown in the portability message at the top of the page, but also for things like fields of an enum variant if that variant itself is cfg-gated then don't repeat those cfg on each field of the variant. This does not touch trait implementation rendering, as that is more complex and there are existing issues around how it deals with doc-cfg that need to be fixed first. ### Screenshots, left is current, right is new: ![image](https://user-images.githubusercontent.com/81079/95387261-c2e6a200-08f0-11eb-90d4-0a9734acd922.png) ![image](https://user-images.githubusercontent.com/81079/95387458-06411080-08f1-11eb-81f7-5dd7f37695dd.png) ![image](https://user-images.githubusercontent.com/81079/95387702-6637b700-08f1-11eb-82f4-46b6cd9b24f2.png) ![image](https://user-images.githubusercontent.com/81079/95387905-b9aa0500-08f1-11eb-8d95-8b618d31d419.png) ![image](https://user-images.githubusercontent.com/81079/95388300-5bc9ed00-08f2-11eb-9ac9-b92cbdb60b89.png) cc #43781
This commit is contained in:
commit
71b0ea6235
@ -201,6 +201,37 @@ impl Cfg {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Attempt to simplify this cfg by assuming that `assume` is already known to be true, will
|
||||
/// return `None` if simplification managed to completely eliminate any requirements from this
|
||||
/// `Cfg`.
|
||||
///
|
||||
/// See `tests::test_simplify_with` for examples.
|
||||
pub(crate) fn simplify_with(&self, assume: &Cfg) -> Option<Cfg> {
|
||||
if self == assume {
|
||||
return None;
|
||||
}
|
||||
|
||||
if let Cfg::All(a) = self {
|
||||
let mut sub_cfgs: Vec<Cfg> = if let Cfg::All(b) = assume {
|
||||
a.iter().filter(|a| !b.contains(a)).cloned().collect()
|
||||
} else {
|
||||
a.iter().filter(|&a| a != assume).cloned().collect()
|
||||
};
|
||||
let len = sub_cfgs.len();
|
||||
return match len {
|
||||
0 => None,
|
||||
1 => sub_cfgs.pop(),
|
||||
_ => Some(Cfg::All(sub_cfgs)),
|
||||
};
|
||||
} else if let Cfg::All(b) = assume {
|
||||
if b.contains(self) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
Some(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Not for Cfg {
|
||||
|
@ -433,3 +433,39 @@ fn test_render_long_html() {
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_simplify_with() {
|
||||
// This is a tiny subset of things that could be simplified, but it likely covers 90% of
|
||||
// real world usecases well.
|
||||
with_default_session_globals(|| {
|
||||
let foo = word_cfg("foo");
|
||||
let bar = word_cfg("bar");
|
||||
let baz = word_cfg("baz");
|
||||
let quux = word_cfg("quux");
|
||||
|
||||
let foobar = Cfg::All(vec![foo.clone(), bar.clone()]);
|
||||
let barbaz = Cfg::All(vec![bar.clone(), baz.clone()]);
|
||||
let foobarbaz = Cfg::All(vec![foo.clone(), bar.clone(), baz.clone()]);
|
||||
let bazquux = Cfg::All(vec![baz.clone(), quux.clone()]);
|
||||
|
||||
// Unrelated cfgs don't affect each other
|
||||
assert_eq!(foo.simplify_with(&bar).as_ref(), Some(&foo));
|
||||
assert_eq!(foobar.simplify_with(&bazquux).as_ref(), Some(&foobar));
|
||||
|
||||
// Identical cfgs are eliminated
|
||||
assert_eq!(foo.simplify_with(&foo), None);
|
||||
assert_eq!(foobar.simplify_with(&foobar), None);
|
||||
|
||||
// Multiple cfgs eliminate a single assumed cfg
|
||||
assert_eq!(foobar.simplify_with(&foo).as_ref(), Some(&bar));
|
||||
assert_eq!(foobar.simplify_with(&bar).as_ref(), Some(&foo));
|
||||
|
||||
// A single cfg is eliminated by multiple assumed cfg containing it
|
||||
assert_eq!(foo.simplify_with(&foobar), None);
|
||||
|
||||
// Multiple cfgs eliminate the matching subset of multiple assumed cfg
|
||||
assert_eq!(foobar.simplify_with(&barbaz).as_ref(), Some(&foo));
|
||||
assert_eq!(foobar.simplify_with(&foobarbaz), None);
|
||||
});
|
||||
}
|
||||
|
@ -1763,11 +1763,11 @@ crate fn shorten(s: String) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn document(w: &mut Buffer, cx: &Context, item: &clean::Item) {
|
||||
fn document(w: &mut Buffer, cx: &Context, item: &clean::Item, parent: Option<&clean::Item>) {
|
||||
if let Some(ref name) = item.name {
|
||||
info!("Documenting {}", name);
|
||||
}
|
||||
document_stability(w, cx, item, false);
|
||||
document_stability(w, cx, item, false, parent);
|
||||
document_full(w, item, cx, "", false);
|
||||
}
|
||||
|
||||
@ -1851,8 +1851,14 @@ fn document_full(w: &mut Buffer, item: &clean::Item, cx: &Context, prefix: &str,
|
||||
}
|
||||
}
|
||||
|
||||
fn document_stability(w: &mut Buffer, cx: &Context, item: &clean::Item, is_hidden: bool) {
|
||||
let stabilities = short_stability(item, cx);
|
||||
fn document_stability(
|
||||
w: &mut Buffer,
|
||||
cx: &Context,
|
||||
item: &clean::Item,
|
||||
is_hidden: bool,
|
||||
parent: Option<&clean::Item>,
|
||||
) {
|
||||
let stabilities = short_stability(item, cx, parent);
|
||||
if !stabilities.is_empty() {
|
||||
write!(w, "<div class='stability{}'>", if is_hidden { " hidden" } else { "" });
|
||||
for stability in stabilities {
|
||||
@ -1952,7 +1958,7 @@ pub fn compare_names(mut lhs: &str, mut rhs: &str) -> Ordering {
|
||||
}
|
||||
|
||||
fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean::Item]) {
|
||||
document(w, cx, item);
|
||||
document(w, cx, item, None);
|
||||
|
||||
let mut indices = (0..items.len()).filter(|i| !items[*i].is_stripped()).collect::<Vec<usize>>();
|
||||
|
||||
@ -2111,7 +2117,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
|
||||
<td class='docblock-short'>{stab_tags}{docs}</td>\
|
||||
</tr>",
|
||||
name = *myitem.name.as_ref().unwrap(),
|
||||
stab_tags = stability_tags(myitem),
|
||||
stab_tags = stability_tags(myitem, item),
|
||||
docs = MarkdownSummaryLine(doc_value, &myitem.links()).into_string(),
|
||||
class = myitem.type_(),
|
||||
add = add,
|
||||
@ -2135,7 +2141,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
|
||||
|
||||
/// Render the stability and deprecation tags that are displayed in the item's summary at the
|
||||
/// module level.
|
||||
fn stability_tags(item: &clean::Item) -> String {
|
||||
fn stability_tags(item: &clean::Item, parent: &clean::Item) -> String {
|
||||
let mut tags = String::new();
|
||||
|
||||
fn tag_html(class: &str, title: &str, contents: &str) -> String {
|
||||
@ -2159,7 +2165,13 @@ fn stability_tags(item: &clean::Item) -> String {
|
||||
tags += &tag_html("unstable", "", "Experimental");
|
||||
}
|
||||
|
||||
if let Some(ref cfg) = item.attrs.cfg {
|
||||
let cfg = match (&item.attrs.cfg, parent.attrs.cfg.as_ref()) {
|
||||
(Some(cfg), Some(parent_cfg)) => cfg.simplify_with(parent_cfg),
|
||||
(cfg, _) => cfg.as_deref().cloned(),
|
||||
};
|
||||
|
||||
debug!("Portability {:?} - {:?} = {:?}", item.attrs.cfg, parent.attrs.cfg, cfg);
|
||||
if let Some(ref cfg) = cfg {
|
||||
tags += &tag_html("portability", &cfg.render_long_plain(), &cfg.render_short_html());
|
||||
}
|
||||
|
||||
@ -2168,7 +2180,7 @@ fn stability_tags(item: &clean::Item) -> String {
|
||||
|
||||
/// Render the stability and/or deprecation warning that is displayed at the top of the item's
|
||||
/// documentation.
|
||||
fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
||||
fn short_stability(item: &clean::Item, cx: &Context, parent: Option<&clean::Item>) -> Vec<String> {
|
||||
let mut stability = vec![];
|
||||
let error_codes = cx.shared.codes;
|
||||
|
||||
@ -2243,7 +2255,18 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
|
||||
stability.push(format!("<div class='stab unstable'>{}</div>", message));
|
||||
}
|
||||
|
||||
if let Some(ref cfg) = item.attrs.cfg {
|
||||
let cfg = match (&item.attrs.cfg, parent.and_then(|p| p.attrs.cfg.as_ref())) {
|
||||
(Some(cfg), Some(parent_cfg)) => cfg.simplify_with(parent_cfg),
|
||||
(cfg, _) => cfg.as_deref().cloned(),
|
||||
};
|
||||
|
||||
debug!(
|
||||
"Portability {:?} - {:?} = {:?}",
|
||||
item.attrs.cfg,
|
||||
parent.and_then(|p| p.attrs.cfg.as_ref()),
|
||||
cfg
|
||||
);
|
||||
if let Some(cfg) = cfg {
|
||||
stability.push(format!("<div class='stab portability'>{}</div>", cfg.render_long_html()));
|
||||
}
|
||||
|
||||
@ -2282,7 +2305,7 @@ fn item_constant(w: &mut Buffer, cx: &Context, it: &clean::Item, c: &clean::Cons
|
||||
}
|
||||
|
||||
write!(w, "</pre>");
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
fn item_static(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Static) {
|
||||
@ -2296,7 +2319,7 @@ fn item_static(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Static
|
||||
name = it.name.as_ref().unwrap(),
|
||||
typ = s.type_.print()
|
||||
);
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Function) {
|
||||
@ -2329,7 +2352,7 @@ fn item_function(w: &mut Buffer, cx: &Context, it: &clean::Item, f: &clean::Func
|
||||
.print(),
|
||||
spotlight = spotlight_decl(&f.decl),
|
||||
);
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
fn render_implementor(
|
||||
@ -2354,6 +2377,7 @@ fn render_implementor(
|
||||
w,
|
||||
cx,
|
||||
implementor,
|
||||
None,
|
||||
AssocItemLink::Anchor(None),
|
||||
RenderMode::Normal,
|
||||
implementor.impl_item.stable_since().as_deref(),
|
||||
@ -2383,6 +2407,7 @@ fn render_impls(
|
||||
&mut buffer,
|
||||
cx,
|
||||
i,
|
||||
Some(containing_item),
|
||||
assoc_link,
|
||||
RenderMode::Normal,
|
||||
containing_item.stable_since().as_deref(),
|
||||
@ -2502,7 +2527,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
|
||||
});
|
||||
|
||||
// Trait documentation
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
|
||||
fn write_small_section_header(w: &mut Buffer, id: &str, title: &str, extra_content: &str) {
|
||||
write!(
|
||||
@ -2520,6 +2545,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
|
||||
|
||||
fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item) {
|
||||
let name = m.name.as_ref().unwrap();
|
||||
info!("Documenting {} on {}", name, t.name.as_deref().unwrap_or_default());
|
||||
let item_type = m.type_();
|
||||
let id = cx.derive_id(format!("{}.{}", item_type, name));
|
||||
write!(w, "<h3 id='{id}' class='method'><code>", id = id,);
|
||||
@ -2527,7 +2553,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
|
||||
write!(w, "</code>");
|
||||
render_stability_since(w, m, t);
|
||||
write!(w, "</h3>");
|
||||
document(w, cx, m);
|
||||
document(w, cx, m, Some(t));
|
||||
}
|
||||
|
||||
if !types.is_empty() {
|
||||
@ -2628,6 +2654,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
|
||||
w,
|
||||
cx,
|
||||
&implementor,
|
||||
None,
|
||||
assoc_link,
|
||||
RenderMode::Normal,
|
||||
implementor.impl_item.stable_since().as_deref(),
|
||||
@ -2890,7 +2917,7 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
|
||||
write!(w, "</pre>")
|
||||
});
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
let mut fields = s
|
||||
.fields
|
||||
.iter()
|
||||
@ -2925,7 +2952,7 @@ fn item_struct(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Struct
|
||||
name = field.name.as_ref().unwrap(),
|
||||
ty = ty.print()
|
||||
);
|
||||
document(w, cx, field);
|
||||
document(w, cx, field, Some(it));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2940,7 +2967,7 @@ fn item_union(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Union,
|
||||
write!(w, "</pre>")
|
||||
});
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
let mut fields = s
|
||||
.fields
|
||||
.iter()
|
||||
@ -2972,7 +2999,7 @@ fn item_union(w: &mut Buffer, cx: &Context, it: &clean::Item, s: &clean::Union,
|
||||
if let Some(stability_class) = field.stability_class() {
|
||||
write!(w, "<span class='stab {stab}'></span>", stab = stability_class);
|
||||
}
|
||||
document(w, cx, field);
|
||||
document(w, cx, field, Some(it));
|
||||
}
|
||||
}
|
||||
render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All, cache)
|
||||
@ -3027,7 +3054,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca
|
||||
write!(w, "</pre>")
|
||||
});
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
if !e.variants.is_empty() {
|
||||
write!(
|
||||
w,
|
||||
@ -3060,7 +3087,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca
|
||||
}
|
||||
}
|
||||
write!(w, "</code></div>");
|
||||
document(w, cx, variant);
|
||||
document(w, cx, variant, Some(it));
|
||||
document_non_exhaustive(w, variant);
|
||||
|
||||
use crate::clean::{Variant, VariantKind};
|
||||
@ -3095,7 +3122,7 @@ fn item_enum(w: &mut Buffer, cx: &Context, it: &clean::Item, e: &clean::Enum, ca
|
||||
f = field.name.as_ref().unwrap(),
|
||||
t = ty.print()
|
||||
);
|
||||
document(w, cx, field);
|
||||
document(w, cx, field, Some(variant));
|
||||
}
|
||||
}
|
||||
write!(w, "</div></div>");
|
||||
@ -3293,6 +3320,10 @@ fn render_assoc_items(
|
||||
what: AssocItemRender<'_>,
|
||||
cache: &Cache,
|
||||
) {
|
||||
info!(
|
||||
"Documenting associated items of {}",
|
||||
containing_item.name.as_deref().unwrap_or_default()
|
||||
);
|
||||
let v = match cache.impls.get(&it) {
|
||||
Some(v) => v,
|
||||
None => return,
|
||||
@ -3327,6 +3358,7 @@ fn render_assoc_items(
|
||||
w,
|
||||
cx,
|
||||
i,
|
||||
Some(containing_item),
|
||||
AssocItemLink::Anchor(None),
|
||||
render_mode,
|
||||
containing_item.stable_since().as_deref(),
|
||||
@ -3518,6 +3550,7 @@ fn render_impl(
|
||||
w: &mut Buffer,
|
||||
cx: &Context,
|
||||
i: &Impl,
|
||||
parent: Option<&clean::Item>,
|
||||
link: AssocItemLink<'_>,
|
||||
render_mode: RenderMode,
|
||||
outer_version: Option<&str>,
|
||||
@ -3600,6 +3633,7 @@ fn render_impl(
|
||||
w: &mut Buffer,
|
||||
cx: &Context,
|
||||
item: &clean::Item,
|
||||
parent: Option<&clean::Item>,
|
||||
link: AssocItemLink<'_>,
|
||||
render_mode: RenderMode,
|
||||
is_default_item: bool,
|
||||
@ -3684,7 +3718,7 @@ fn render_impl(
|
||||
if let Some(it) = t.items.iter().find(|i| i.name == item.name) {
|
||||
// We need the stability of the item from the trait
|
||||
// because impls can't have a stability.
|
||||
document_stability(w, cx, it, is_hidden);
|
||||
document_stability(w, cx, it, is_hidden, parent);
|
||||
if item.doc_value().is_some() {
|
||||
document_full(w, item, cx, "", is_hidden);
|
||||
} else if show_def_docs {
|
||||
@ -3694,13 +3728,13 @@ fn render_impl(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document_stability(w, cx, item, is_hidden);
|
||||
document_stability(w, cx, item, is_hidden, parent);
|
||||
if show_def_docs {
|
||||
document_full(w, item, cx, "", is_hidden);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
document_stability(w, cx, item, is_hidden);
|
||||
document_stability(w, cx, item, is_hidden, parent);
|
||||
if show_def_docs {
|
||||
document_short(w, item, link, "", is_hidden);
|
||||
}
|
||||
@ -3717,6 +3751,7 @@ fn render_impl(
|
||||
w,
|
||||
cx,
|
||||
trait_item,
|
||||
parent,
|
||||
link,
|
||||
render_mode,
|
||||
false,
|
||||
@ -3732,6 +3767,7 @@ fn render_impl(
|
||||
cx: &Context,
|
||||
t: &clean::Trait,
|
||||
i: &clean::Impl,
|
||||
parent: Option<&clean::Item>,
|
||||
render_mode: RenderMode,
|
||||
outer_version: Option<&str>,
|
||||
show_def_docs: bool,
|
||||
@ -3749,6 +3785,7 @@ fn render_impl(
|
||||
w,
|
||||
cx,
|
||||
trait_item,
|
||||
parent,
|
||||
assoc_link,
|
||||
render_mode,
|
||||
true,
|
||||
@ -3771,6 +3808,7 @@ fn render_impl(
|
||||
cx,
|
||||
t,
|
||||
&i.inner_impl(),
|
||||
parent,
|
||||
render_mode,
|
||||
outer_version,
|
||||
show_def_docs,
|
||||
@ -3799,7 +3837,7 @@ fn item_opaque_ty(
|
||||
bounds = bounds(&t.bounds, false)
|
||||
);
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
|
||||
// Render any items associated directly to this alias, as otherwise they
|
||||
// won't be visible anywhere in the docs. It would be nice to also show
|
||||
@ -3826,7 +3864,7 @@ fn item_trait_alias(
|
||||
bounds(&t.bounds, true)
|
||||
);
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
|
||||
// Render any items associated directly to this alias, as otherwise they
|
||||
// won't be visible anywhere in the docs. It would be nice to also show
|
||||
@ -3847,7 +3885,7 @@ fn item_typedef(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Typed
|
||||
type_ = t.type_.print()
|
||||
);
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
|
||||
// Render any items associated directly to this alias, as otherwise they
|
||||
// won't be visible anywhere in the docs. It would be nice to also show
|
||||
@ -3866,7 +3904,7 @@ fn item_foreign_type(w: &mut Buffer, cx: &Context, it: &clean::Item, cache: &Cac
|
||||
it.name.as_ref().unwrap(),
|
||||
);
|
||||
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
|
||||
render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All, cache)
|
||||
}
|
||||
@ -4511,7 +4549,7 @@ fn item_macro(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Macro)
|
||||
None,
|
||||
))
|
||||
});
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
fn item_proc_macro(w: &mut Buffer, cx: &Context, it: &clean::Item, m: &clean::ProcMacro) {
|
||||
@ -4541,16 +4579,16 @@ fn item_proc_macro(w: &mut Buffer, cx: &Context, it: &clean::Item, m: &clean::Pr
|
||||
write!(w, "</pre>");
|
||||
}
|
||||
}
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
fn item_primitive(w: &mut Buffer, cx: &Context, it: &clean::Item, cache: &Cache) {
|
||||
document(w, cx, it);
|
||||
document(w, cx, it, None);
|
||||
render_assoc_items(w, cx, it, it.def_id, AssocItemRender::All, cache)
|
||||
}
|
||||
|
||||
fn item_keyword(w: &mut Buffer, cx: &Context, it: &clean::Item) {
|
||||
document(w, cx, it)
|
||||
document(w, cx, it, None)
|
||||
}
|
||||
|
||||
crate const BASIC_KEYWORDS: &str = "rust, rustlang, rust-lang";
|
||||
|
182
src/test/rustdoc/doc-cfg-simplification.rs
Normal file
182
src/test/rustdoc/doc-cfg-simplification.rs
Normal file
@ -0,0 +1,182 @@
|
||||
#![crate_name = "globuliferous"]
|
||||
#![feature(doc_cfg)]
|
||||
|
||||
// @has 'globuliferous/index.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' '^ratel$'
|
||||
|
||||
// @has 'globuliferous/ratel/index.html'
|
||||
// @count - '//*[@class="stab portability"]' 8
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
// @matches - '//*[@class="stab portability"]' '^zoonosology$'
|
||||
// @matches - '//*[@class="stab portability"]' '^yusho$'
|
||||
// @matches - '//*[@class="stab portability"]' '^nunciative$'
|
||||
// @matches - '//*[@class="stab portability"]' '^thionic$'
|
||||
// @matches - '//*[@class="stab portability"]' '^zincic$'
|
||||
// @matches - '//*[@class="stab portability"]' '^cosmotellurian$'
|
||||
// @matches - '//*[@class="stab portability"]' '^aposiopesis$'
|
||||
#[doc(cfg(feature = "ratel"))]
|
||||
pub mod ratel {
|
||||
// @has 'globuliferous/ratel/fn.ovicide.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
pub fn ovicide() {}
|
||||
|
||||
// @has 'globuliferous/ratel/fn.zoonosology.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and zoonosology'
|
||||
#[doc(cfg(feature = "zoonosology"))]
|
||||
pub fn zoonosology() {}
|
||||
|
||||
// @has 'globuliferous/ratel/constant.DIAGRAPHICS.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
pub const DIAGRAPHICS: () = ();
|
||||
|
||||
// @has 'globuliferous/ratel/constant.YUSHO.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and yusho'
|
||||
#[doc(cfg(feature = "yusho"))]
|
||||
pub const YUSHO: () = ();
|
||||
|
||||
// @has 'globuliferous/ratel/static.KEYBUGLE.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
pub static KEYBUGLE: () = ();
|
||||
|
||||
// @has 'globuliferous/ratel/static.NUNCIATIVE.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and nunciative'
|
||||
#[doc(cfg(feature = "nunciative"))]
|
||||
pub static NUNCIATIVE: () = ();
|
||||
|
||||
// @has 'globuliferous/ratel/type.Wrick.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
pub type Wrick = ();
|
||||
|
||||
// @has 'globuliferous/ratel/type.Thionic.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and thionic'
|
||||
#[doc(cfg(feature = "thionic"))]
|
||||
pub type Thionic = ();
|
||||
|
||||
// @has 'globuliferous/ratel/struct.Eventration.html'
|
||||
// @count - '//*[@class="stab portability"]' 1
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
pub struct Eventration;
|
||||
|
||||
// @has 'globuliferous/ratel/struct.Zincic.html'
|
||||
// @count - '//*[@class="stab portability"]' 2
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and zincic'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature rutherford'
|
||||
#[doc(cfg(feature = "zincic"))]
|
||||
pub struct Zincic {
|
||||
pub rectigrade: (),
|
||||
|
||||
#[doc(cfg(feature = "rutherford"))]
|
||||
pub rutherford: (),
|
||||
}
|
||||
|
||||
// @has 'globuliferous/ratel/enum.Cosmotellurian.html'
|
||||
// @count - '//*[@class="stab portability"]' 10
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and cosmotellurian'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature biotaxy'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature xiphopagus'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature juxtapositive'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature fuero'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature palaeophile'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature broadcloth'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features broadcloth and xanthocomic'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature broadcloth'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features broadcloth and whosoever'
|
||||
#[doc(cfg(feature = "cosmotellurian"))]
|
||||
pub enum Cosmotellurian {
|
||||
Groundsel {
|
||||
jagger: (),
|
||||
|
||||
#[doc(cfg(feature = "xiphopagus"))]
|
||||
xiphopagus: (),
|
||||
},
|
||||
|
||||
#[doc(cfg(feature = "biotaxy"))]
|
||||
Biotaxy {
|
||||
glossography: (),
|
||||
|
||||
#[doc(cfg(feature = "juxtapositive"))]
|
||||
juxtapositive: (),
|
||||
},
|
||||
}
|
||||
|
||||
impl Cosmotellurian {
|
||||
pub fn uxoricide() {}
|
||||
|
||||
#[doc(cfg(feature = "fuero"))]
|
||||
pub fn fuero() {}
|
||||
|
||||
pub const MAMELLE: () = ();
|
||||
|
||||
#[doc(cfg(feature = "palaeophile"))]
|
||||
pub const PALAEOPHILE: () = ();
|
||||
}
|
||||
|
||||
#[doc(cfg(feature = "broadcloth"))]
|
||||
impl Cosmotellurian {
|
||||
pub fn trabeculated() {}
|
||||
|
||||
#[doc(cfg(feature = "xanthocomic"))]
|
||||
pub fn xanthocomic() {}
|
||||
|
||||
pub const BRACHIFEROUS: () = ();
|
||||
|
||||
#[doc(cfg(feature = "whosoever"))]
|
||||
pub const WHOSOEVER: () = ();
|
||||
}
|
||||
|
||||
// @has 'globuliferous/ratel/trait.Gnotobiology.html'
|
||||
// @count - '//*[@class="stab portability"]' 4
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature ratel'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature unzymotic'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature summate'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature unctuous'
|
||||
pub trait Gnotobiology {
|
||||
const XYLOTHERAPY: ();
|
||||
|
||||
#[doc(cfg(feature = "unzymotic"))]
|
||||
const UNZYMOTIC: ();
|
||||
|
||||
type Lepadoid;
|
||||
|
||||
#[doc(cfg(feature = "summate"))]
|
||||
type Summate;
|
||||
|
||||
fn decalcomania();
|
||||
|
||||
#[doc(cfg(feature = "unctuous"))]
|
||||
fn unctuous();
|
||||
}
|
||||
|
||||
// @has 'globuliferous/ratel/trait.Aposiopesis.html'
|
||||
// @count - '//*[@class="stab portability"]' 4
|
||||
// @matches - '//*[@class="stab portability"]' 'crate features ratel and aposiopesis'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature umbracious'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature uakari'
|
||||
// @matches - '//*[@class="stab portability"]' 'crate feature rotograph'
|
||||
#[doc(cfg(feature = "aposiopesis"))]
|
||||
pub trait Aposiopesis {
|
||||
const REDHIBITION: ();
|
||||
|
||||
#[doc(cfg(feature = "umbracious"))]
|
||||
const UMBRACIOUS: ();
|
||||
|
||||
type Ophthalmoscope;
|
||||
|
||||
#[doc(cfg(feature = "uakari"))]
|
||||
type Uakari;
|
||||
|
||||
fn meseems();
|
||||
|
||||
#[doc(cfg(feature = "rotograph"))]
|
||||
fn rotograph();
|
||||
}
|
||||
}
|
@ -10,9 +10,8 @@ pub struct Portable;
|
||||
// @has doc_cfg/unix_only/index.html \
|
||||
// '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
|
||||
// 'This is supported on Unix only.'
|
||||
// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AUnix\Z'
|
||||
// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AUnix and ARM\Z'
|
||||
// @count - '//*[@class="stab portability"]' 3
|
||||
// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AARM\Z'
|
||||
// @count - '//*[@class="stab portability"]' 2
|
||||
#[doc(cfg(unix))]
|
||||
pub mod unix_only {
|
||||
// @has doc_cfg/unix_only/fn.unix_only_function.html \
|
||||
@ -26,7 +25,7 @@ pub mod unix_only {
|
||||
// @has doc_cfg/unix_only/trait.ArmOnly.html \
|
||||
// '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
|
||||
// 'This is supported on Unix and ARM only.'
|
||||
// @count - '//*[@class="stab portability"]' 3
|
||||
// @count - '//*[@class="stab portability"]' 2
|
||||
#[doc(cfg(target_arch = "arm"))]
|
||||
pub trait ArmOnly {
|
||||
fn unix_and_arm_only_function();
|
||||
|
@ -14,45 +14,41 @@
|
||||
pub struct Foo;
|
||||
|
||||
// @has 'foo/bar/index.html'
|
||||
// @matches '-' '//*[@class="module-item"]//*[@class="stab portability"]' '^sync$'
|
||||
// @has '-' '//*[@class="module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` only'
|
||||
|
||||
// @has 'foo/bar/struct.Bar.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.'
|
||||
#[doc(cfg(feature = "sync"))]
|
||||
pub mod bar {
|
||||
// @has 'foo/bar/struct.Bar.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.'
|
||||
#[doc(cfg(feature = "sync"))]
|
||||
pub struct Bar;
|
||||
}
|
||||
|
||||
// @has 'foo/baz/index.html'
|
||||
// @matches '-' '//*[@class="module-item"]//*[@class="stab portability"]' '^sync and send$'
|
||||
// @has '-' '//*[@class="module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate features `sync` and `send` only'
|
||||
|
||||
// @has 'foo/baz/struct.Baz.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.'
|
||||
#[doc(cfg(all(feature = "sync", feature = "send")))]
|
||||
pub mod baz {
|
||||
// @has 'foo/baz/struct.Baz.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.'
|
||||
#[doc(cfg(feature = "sync"))]
|
||||
pub struct Baz;
|
||||
}
|
||||
|
||||
// @has 'foo/qux/struct.Qux.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.'
|
||||
// @has 'foo/qux/index.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync only.'
|
||||
#[doc(cfg(feature = "sync"))]
|
||||
pub mod qux {
|
||||
// @has 'foo/qux/struct.Qux.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate features sync and send only.'
|
||||
#[doc(cfg(all(feature = "sync", feature = "send")))]
|
||||
pub struct Qux;
|
||||
}
|
||||
|
||||
// @has 'foo/quux/index.html'
|
||||
// @matches '-' '//*[@class="module-item"]//*[@class="stab portability"]' '^sync and send and foo and bar$'
|
||||
// @has '-' '//*[@class="module-item"]//*[@class="stab portability"]/@title' 'This is supported on crate feature `sync` and crate feature `send` and `foo` and `bar` only'
|
||||
|
||||
// @has 'foo/quux/struct.Quux.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync and crate feature send and foo and bar only.'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync and crate feature send and foo only.'
|
||||
#[doc(cfg(all(feature = "sync", feature = "send", foo)))]
|
||||
pub mod quux {
|
||||
// @has 'foo/quux/struct.Quux.html'
|
||||
// @has '-' '//*[@class="stab portability"]' 'This is supported on crate feature sync and crate feature send and foo and bar only.'
|
||||
#[doc(cfg(all(feature = "send", feature = "sync", bar)))]
|
||||
pub struct Quux;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user