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 
split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool16     fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P>
17         where P: FnMut(&Self::Item) -> bool;
splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN<Splits<'a, Self::Item, P>> where P: FnMut(&Self::Item) -> bool18     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 
split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool25     fn split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool {
26         loop {}
27     }
28 
splitn2<P>(&self, n: u32, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool29     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 
main()35 fn main() { }
36