Skip to content

Commit 2d9755f

Browse files
committed
rustdoc: move cross-crate lifetime/outlives bounds on GAT params from where-clause to param declaration site
I've overlooked this in rust-lang#103190.
1 parent 9cdab67 commit 2d9755f

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/librustdoc/clean/mod.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,16 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
13031303
..
13041304
}) = generics.params.iter_mut().find(|param| &param.name == arg)
13051305
{
1306-
param_bounds.extend(mem::take(bounds));
1306+
param_bounds.append(bounds);
1307+
} else if let WherePredicate::RegionPredicate { lifetime: Lifetime(arg), bounds } = &mut pred
1308+
&& let Some(GenericParamDef {
1309+
kind: GenericParamDefKind::Lifetime { outlives: param_bounds },
1310+
..
1311+
}) = generics.params.iter_mut().find(|param| &param.name == arg) {
1312+
param_bounds.extend(bounds.drain(..).map(|bound| match bound {
1313+
GenericBound::Outlives(lifetime) => lifetime,
1314+
_ => unreachable!(),
1315+
}));
13071316
} else {
13081317
where_predicates.push(pred);
13091318
}

src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs

+4
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ extern crate assoc_item_trait_bounds as aux;
3838
// F: FnOnce(u32) -> String, \
3939
// Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>"
4040
pub use aux::Main;
41+
42+
// @has main/trait.Aid.html
43+
// @has - '//*[@id="associatedtype.Result"]' "type Result<'inter: 'src>"
44+
pub use aux::Aid;

src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ pub trait Helper {
4242
}
4343

4444
pub trait Aid<'src> {
45-
type Result<'inter>;
45+
type Result<'inter: 'src>;
4646
}

0 commit comments

Comments
 (0)