Rollup merge of #98911 - notriddle:notriddle/rustdoc-string-impl, r=GuillaumeGomez

rustdoc: filter '_ lifetimes from ty::Generics

Fixes a weirdly-rendered section of the std::string::String docs.

Before:

![image](https://user-images.githubusercontent.com/1593513/177256873-20b9cf6e-2429-4865-853b-b269d74672f4.png)

After:

![image](https://user-images.githubusercontent.com/1593513/177256900-ef3efd17-f624-40c5-af90-fe709ec034f2.png)
This commit is contained in:
Guillaume Gomez 2022-07-06 20:43:25 +02:00 committed by GitHub
commit d87bf24925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;