Skip to content

Commit

Permalink
rustdoc: move cross-crate lifetime/outlives bounds on GAT params from…
Browse files Browse the repository at this point in the history
… where-clause to param declaration site

I've overlooked this in rust-lang#103190.
  • Loading branch information
fmease committed Nov 4, 2022
1 parent 9cdab67 commit 2d9755f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,16 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
..
}) = generics.params.iter_mut().find(|param| &param.name == arg)
{
param_bounds.extend(mem::take(bounds));
param_bounds.append(bounds);
} else if let WherePredicate::RegionPredicate { lifetime: Lifetime(arg), bounds } = &mut pred
&& let Some(GenericParamDef {
kind: GenericParamDefKind::Lifetime { outlives: param_bounds },
..
}) = generics.params.iter_mut().find(|param| &param.name == arg) {
param_bounds.extend(bounds.drain(..).map(|bound| match bound {
GenericBound::Outlives(lifetime) => lifetime,
_ => unreachable!(),
}));
} else {
where_predicates.push(pred);
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ extern crate assoc_item_trait_bounds as aux;
// F: FnOnce(u32) -> String, \
// Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>"
pub use aux::Main;

// @has main/trait.Aid.html
// @has - '//*[@id="associatedtype.Result"]' "type Result<'inter: 'src>"
pub use aux::Aid;
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ pub trait Helper {
}

pub trait Aid<'src> {
type Result<'inter>;
type Result<'inter: 'src>;
}

0 comments on commit 2d9755f

Please sign in to comment.