Skip to content

Commit d87bf24

Browse files
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)
2 parents d712f67 + 3ac1a9b commit d87bf24

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/librustdoc/clean/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ fn clean_ty_generics<'tcx>(
629629
.params
630630
.iter()
631631
.filter_map(|param| match param.kind {
632+
ty::GenericParamDefKind::Lifetime if param.name == kw::UnderscoreLifetime => None,
632633
ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)),
633634
ty::GenericParamDefKind::Type { synthetic, .. } => {
634635
if param.name == kw::SelfUpper {

src/test/rustdoc/auxiliary/issue-98697-reexport-with-anonymous-lifetime.rs

+8
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ where
77
{
88
unimplemented!()
99
}
10+
11+
pub struct Extra;
12+
13+
pub trait MyTrait<T> {
14+
fn run() {}
15+
}
16+
17+
impl MyTrait<&Extra> for Extra {}

src/test/rustdoc/issue-98697.rs

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

0 commit comments

Comments
 (0)