mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Hide host effect params from docs
This commit is contained in:
parent
20363f40a9
commit
c4e61faf2e
@ -521,7 +521,7 @@ fn clean_generic_param_def<'tcx>(
|
||||
},
|
||||
)
|
||||
}
|
||||
ty::GenericParamDefKind::Const { has_default, .. } => (
|
||||
ty::GenericParamDefKind::Const { has_default, is_host_effect } => (
|
||||
def.name,
|
||||
GenericParamDefKind::Const {
|
||||
ty: Box::new(clean_middle_ty(
|
||||
@ -541,6 +541,7 @@ fn clean_generic_param_def<'tcx>(
|
||||
)),
|
||||
false => None,
|
||||
},
|
||||
is_host_effect,
|
||||
},
|
||||
),
|
||||
};
|
||||
@ -597,6 +598,7 @@ fn clean_generic_param<'tcx>(
|
||||
ty: Box::new(clean_ty(ty, cx)),
|
||||
default: default
|
||||
.map(|ct| Box::new(ty::Const::from_anon_const(cx.tcx, ct.def_id).to_string())),
|
||||
is_host_effect: cx.tcx.has_attr(param.def_id, sym::rustc_host),
|
||||
},
|
||||
),
|
||||
};
|
||||
|
@ -1306,7 +1306,7 @@ impl WherePredicate {
|
||||
pub(crate) enum GenericParamDefKind {
|
||||
Lifetime { outlives: Vec<Lifetime> },
|
||||
Type { did: DefId, bounds: Vec<GenericBound>, default: Option<Box<Type>>, synthetic: bool },
|
||||
Const { ty: Box<Type>, default: Option<Box<String>> },
|
||||
Const { ty: Box<Type>, default: Option<Box<String>>, is_host_effect: bool },
|
||||
}
|
||||
|
||||
impl GenericParamDefKind {
|
||||
@ -1326,9 +1326,10 @@ impl GenericParamDef {
|
||||
Self { name, kind: GenericParamDefKind::Lifetime { outlives: Vec::new() } }
|
||||
}
|
||||
|
||||
pub(crate) fn is_synthetic_type_param(&self) -> bool {
|
||||
pub(crate) fn is_synthetic_param(&self) -> bool {
|
||||
match self.kind {
|
||||
GenericParamDefKind::Lifetime { .. } | GenericParamDefKind::Const { .. } => false,
|
||||
GenericParamDefKind::Lifetime { .. } => false,
|
||||
GenericParamDefKind::Const { is_host_effect, .. } => is_host_effect,
|
||||
GenericParamDefKind::Type { synthetic, .. } => synthetic,
|
||||
}
|
||||
}
|
||||
|
@ -250,8 +250,7 @@ impl clean::Generics {
|
||||
cx: &'a Context<'tcx>,
|
||||
) -> impl fmt::Display + 'a + Captures<'tcx> {
|
||||
display_fn(move |f| {
|
||||
let mut real_params =
|
||||
self.params.iter().filter(|p| !p.is_synthetic_type_param()).peekable();
|
||||
let mut real_params = self.params.iter().filter(|p| !p.is_synthetic_param()).peekable();
|
||||
if real_params.peek().is_none() {
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ impl FromWithTcx<clean::GenericParamDefKind> for GenericParamDefKind {
|
||||
default: default.map(|x| (*x).into_tcx(tcx)),
|
||||
synthetic,
|
||||
},
|
||||
Const { ty, default } => GenericParamDefKind::Const {
|
||||
Const { ty, default, is_host_effect: _ } => GenericParamDefKind::Const {
|
||||
type_: (*ty).into_tcx(tcx),
|
||||
default: default.map(|x| *x),
|
||||
},
|
||||
@ -491,12 +491,14 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
|
||||
default: default.map(|ty| (*ty).into_tcx(tcx)),
|
||||
synthetic,
|
||||
},
|
||||
clean::GenericParamDefKind::Const { ty, default } => {
|
||||
GenericParamDefKind::Const {
|
||||
type_: (*ty).into_tcx(tcx),
|
||||
default: default.map(|d| *d),
|
||||
}
|
||||
}
|
||||
clean::GenericParamDefKind::Const {
|
||||
ty,
|
||||
default,
|
||||
is_host_effect: _,
|
||||
} => GenericParamDefKind::Const {
|
||||
type_: (*ty).into_tcx(tcx),
|
||||
default: default.map(|d| *d),
|
||||
},
|
||||
};
|
||||
GenericParamDef { name, kind }
|
||||
})
|
||||
|
@ -2,14 +2,14 @@
|
||||
#![feature(effects)]
|
||||
|
||||
// @has foo/fn.bar.html
|
||||
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar<const host: bool = true>() -> '
|
||||
// @has - '//pre[@class="rust item-decl"]' 'pub const fn bar() -> '
|
||||
/// foo
|
||||
pub const fn bar() -> usize {
|
||||
2
|
||||
}
|
||||
|
||||
// @has foo/struct.Foo.html
|
||||
// @has - '//*[@class="method"]' 'const fn new<const host: bool = true>()'
|
||||
// @has - '//*[@class="method"]' 'const fn new()'
|
||||
pub struct Foo(usize);
|
||||
|
||||
impl Foo {
|
||||
|
Loading…
Reference in New Issue
Block a user