Skip to content

Commit 3ac1a9b

Browse files
committed
rustdoc: filter '_ lifetimes from ty::Generics
Fixes a weirdly-rendered section of the std::string::String docs.
1 parent 5b9775f commit 3ac1a9b

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)