2022-09-28 15:54:39 -05:00
|
|
|
// Regression test for issues #77763, #84579 and #102142.
|
|
|
|
#![crate_name = "main"]
|
|
|
|
|
2022-10-18 08:34:41 -05:00
|
|
|
// aux-build:assoc_item_trait_bounds.rs
|
2022-09-28 15:54:39 -05:00
|
|
|
// build-aux-docs
|
|
|
|
// ignore-cross-compile
|
2022-10-18 08:34:41 -05:00
|
|
|
extern crate assoc_item_trait_bounds as aux;
|
2022-09-28 15:54:39 -05:00
|
|
|
|
|
|
|
// @has main/trait.Main.html
|
|
|
|
// @has - '//*[@id="associatedtype.Out0"]' 'type Out0: Support<Item = ()>'
|
|
|
|
// @has - '//*[@id="associatedtype.Out1"]' 'type Out1: Support<Item = Self::Item>'
|
|
|
|
// @has - '//*[@id="associatedtype.Out2"]' 'type Out2<T>: Support<Item = T>'
|
|
|
|
// @has - '//*[@id="associatedtype.Out3"]' 'type Out3: Support<Produce<()> = bool>'
|
|
|
|
// @has - '//*[@id="associatedtype.Out4"]' 'type Out4<T>: Support<Produce<T> = T>'
|
|
|
|
// @has - '//*[@id="associatedtype.Out5"]' "type Out5: Support<Output<'static> = &'static ()>"
|
2022-10-04 07:08:25 -05:00
|
|
|
// @has - '//*[@id="associatedtype.Out6"]' "type Out6: for<'a> Support<Output<'a> = &'a ()>"
|
2022-09-28 15:54:39 -05:00
|
|
|
// @has - '//*[@id="associatedtype.Out7"]' "type Out7: Support<Item = String, Produce<i32> = u32> + Unrelated"
|
|
|
|
// @has - '//*[@id="associatedtype.Out8"]' "type Out8: Unrelated + Protocol<i16, Q1 = u128, Q0 = ()>"
|
|
|
|
// @has - '//*[@id="associatedtype.Out9"]' "type Out9: FnMut(i32) -> bool + Clone"
|
|
|
|
// @has - '//*[@id="associatedtype.Out10"]' "type Out10<'q>: Support<Output<'q> = ()>"
|
2022-10-04 07:08:25 -05:00
|
|
|
// @has - '//*[@id="associatedtype.Out11"]' "type Out11: for<'r, 's> Helper<A<'s> = &'s (), B<'r> = ()>"
|
|
|
|
// @has - '//*[@id="associatedtype.Out12"]' "type Out12: for<'w> Helper<B<'w> = Cow<'w, str>, A<'w> = bool>"
|
|
|
|
// @has - '//*[@id="associatedtype.Out13"]' "type Out13: for<'fst, 'snd> Aid<'snd, Result<'fst> = &'fst mut str>"
|
2022-10-18 08:34:41 -05:00
|
|
|
// @has - '//*[@id="associatedtype.Out14"]' "type Out14<P: Copy + Eq, Q: ?Sized>"
|
2022-09-28 15:54:39 -05:00
|
|
|
//
|
2022-10-18 08:34:41 -05:00
|
|
|
// Snapshots:
|
|
|
|
// Check that we don't render any where-clauses for the following associated types since
|
|
|
|
// all corresponding projection equality predicates should have already been re-sugared
|
|
|
|
// to associated type bindings:
|
2022-09-28 15:54:39 -05:00
|
|
|
//
|
|
|
|
// @snapshot out0 - '//*[@id="associatedtype.Out0"]/*[@class="code-header"]'
|
2022-10-18 08:34:41 -05:00
|
|
|
// @snapshot out2 - '//*[@id="associatedtype.Out2"]/*[@class="code-header"]'
|
2022-09-28 15:54:39 -05:00
|
|
|
// @snapshot out9 - '//*[@id="associatedtype.Out9"]/*[@class="code-header"]'
|
|
|
|
//
|
|
|
|
// @has - '//*[@id="tymethod.make"]' \
|
2022-11-02 09:13:54 -05:00
|
|
|
// "fn make<F>(_: F, _: impl FnMut(&str) -> bool)\
|
2022-09-28 15:54:39 -05:00
|
|
|
// where \
|
|
|
|
// F: FnOnce(u32) -> String, \
|
|
|
|
// Self::Out2<()>: Protocol<u8, Q0 = Self::Item, Q1 = ()>"
|
|
|
|
pub use aux::Main;
|
2022-11-02 09:17:34 -05:00
|
|
|
|
|
|
|
// @has main/trait.Aid.html
|
|
|
|
// @has - '//*[@id="associatedtype.Result"]' "type Result<'inter: 'src>"
|
|
|
|
pub use aux::Aid;
|
2023-06-22 03:42:02 -05:00
|
|
|
|
|
|
|
// Below, ensure that we correctly display generic parameters and where-clauses on
|
|
|
|
// associated types inside trait *impls*. More particularly, check that we don't render
|
|
|
|
// any bounds (here `Self::Alias<T>: ...`) as item bounds unlike all the trait test cases above.
|
|
|
|
|
|
|
|
// @has main/struct.Implementor.html
|
|
|
|
// @has - '//*[@id="associatedtype.Alias"]' \
|
|
|
|
// "type Alias<T: Eq> = T \
|
|
|
|
// where \
|
|
|
|
// String: From<T>, \
|
|
|
|
// <Implementor as Implementee>::Alias<T>: From<<Implementor as Implementee>::Alias<T>>"
|
|
|
|
pub use aux::Implementor;
|