diff options
| author | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-02 15:17:34 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-04 19:34:37 +0100 |
| commit | 2d9755fa21bb2184e522a48fa6f3d18f0e1bf62f (patch) | |
| tree | f4df5605b5d0fa34b019894e4f225b05018e984a /src | |
| parent | 9cdab67f6e3f249e677abf3580637fe42324a961 (diff) | |
| download | rust-2d9755fa21bb2184e522a48fa6f3d18f0e1bf62f.tar.gz rust-2d9755fa21bb2184e522a48fa6f3d18f0e1bf62f.zip | |
rustdoc: move cross-crate lifetime/outlives bounds on GAT params from where-clause to param declaration site
I've overlooked this in #103190.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 11 | ||||
| -rw-r--r-- | src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 4a3337ffa1f..eba2d23bdaa 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1303,7 +1303,16 @@ pub(crate) fn clean_middle_assoc_item<'tcx>( .. }) = generics.params.iter_mut().find(|param| ¶m.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| ¶m.name == arg) { + param_bounds.extend(bounds.drain(..).map(|bound| match bound { + GenericBound::Outlives(lifetime) => lifetime, + _ => unreachable!(), + })); } else { where_predicates.push(pred); } diff --git a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs index b58605b9f1c..db2491b87b4 100644 --- a/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs +++ b/src/test/rustdoc/inline_cross/assoc_item_trait_bounds.rs @@ -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; diff --git a/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs index d326e61daea..6644c8e4147 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs @@ -42,5 +42,5 @@ pub trait Helper { } pub trait Aid<'src> { - type Result<'inter>; + type Result<'inter: 'src>; } |
