]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-types/associated-types-normalize-in-bounds-ufcs.rs
feat(rustdoc): open sidebar menu when links inside it are focused
[rust.git] / src / test / ui / associated-types / associated-types-normalize-in-bounds-ufcs.rs
1 // run-pass
2 #![allow(unused_variables)]
3 // Test that we normalize associated types that appear in bounds; if
4 // we didn't, the call to `self.split2()` fails to type check.
5
6 // pretty-expanded FIXME #23616
7
8 use std::marker::PhantomData;
9
10 struct Splits<'a, T:'a, P>(PhantomData<(&'a T, P)>);
11 struct SplitsN<I>(PhantomData<I>);
12
13 trait SliceExt2 {
14     type Item;
15
16     fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>
17         where P: FnMut(&Self::Item) -> bool;
18     fn splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN<Splits<'a, Self::Item, P>>
19         where P: FnMut(&Self::Item) -> bool;
20 }
21
22 impl<T> SliceExt2 for [T] {
23     type Item = T;
24
25     fn split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool {
26         loop {}
27     }
28
29     fn splitn2<P>(&self, n: u32, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
30         SliceExt2::split2(self, pred);
31         loop {}
32     }
33 }
34
35 fn main() { }