]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/associated-types-normalize-in-bounds.rs
New upstream version 1.38.0+dfsg1
[rustc.git] / src / test / ui / associated-types / associated-types-normalize-in-bounds.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, 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: usize, 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: usize, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool {
30 self.split2(pred);
31 loop {}
32 }
33 }
34
35 fn main() { }