Skip to content

Commit cd7bd8b

Browse files
committed
rustdoc: filter '_ lifetimes from ty::PolyTraitRef
Fixes #98697
1 parent 7425fb2 commit cd7bd8b

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
167167
.collect_referenced_late_bound_regions(&poly_trait_ref)
168168
.into_iter()
169169
.filter_map(|br| match br {
170-
ty::BrNamed(_, name) => Some(GenericParamDef {
170+
ty::BrNamed(_, name) if name != kw::UnderscoreLifetime => Some(GenericParamDef {
171171
name,
172172
kind: GenericParamDefKind::Lifetime { outlives: vec![] },
173173
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// When reexporting this function, make sure the anonymous lifetimes are not rendered.
2+
///
3+
/// https://github.com/rust-lang/rust/issues/98697
4+
pub fn repro<F>()
5+
where
6+
F: Fn(&str),
7+
{
8+
unimplemented!()
9+
}

src/test/rustdoc/issue-98697.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// aux-build:issue-98697-reexport-with-anonymous-lifetime.rs
2+
// ignore-cross-compile
3+
4+
// When reexporting a function with a HRTB with anonymous lifetimes,
5+
// make sure the anonymous lifetimes are not rendered.
6+
//
7+
// https://github.com/rust-lang/rust/issues/98697
8+
9+
extern crate issue_98697_reexport_with_anonymous_lifetime;
10+
11+
// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>() where F: Fn(&str)'
12+
// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<'
13+
pub use issue_98697_reexport_with_anonymous_lifetime::repro;

0 commit comments

Comments
 (0)