rustdoc: filter '_ lifetimes from ty::Generics

Fixes a weirdly-rendered section of the std::string::String docs.
This commit is contained in:
Michael Howell 2022-07-04 22:19:53 -07:00
parent 5b9775fe17
commit 3ac1a9b50d
3 changed files with 13 additions and 0 deletions

View File

@ -629,6 +629,7 @@ fn clean_ty_generics<'tcx>(
.params
.iter()
.filter_map(|param| match param.kind {
ty::GenericParamDefKind::Lifetime if param.name == kw::UnderscoreLifetime => None,
ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)),
ty::GenericParamDefKind::Type { synthetic, .. } => {
if param.name == kw::SelfUpper {

View File

@ -7,3 +7,11 @@ where
{
unimplemented!()
}
pub struct Extra;
pub trait MyTrait<T> {
fn run() {}
}
impl MyTrait<&Extra> for Extra {}

View File

@ -11,3 +11,7 @@ extern crate issue_98697_reexport_with_anonymous_lifetime;
// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>() where F: Fn(&str)'
// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<'
pub use issue_98697_reexport_with_anonymous_lifetime::repro;
// @has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header in-band"]' 'impl MyTrait<&Extra> for Extra'
// @!has issue_98697/struct.Extra.html '//div[@id="trait-implementations-list"]//h3[@class="code-header in-band"]' 'impl<'
pub use issue_98697_reexport_with_anonymous_lifetime::Extra;