]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // Test that we normalize associated types that appear in bounds; if | |
12 | // we didn't, the call to `self.split2()` fails to type check. | |
13 | ||
c34b1796 AL |
14 | // pretty-expanded FIXME #23616 |
15 | ||
85aaf69f SL |
16 | use std::marker::PhantomData; |
17 | ||
18 | struct Splits<'a, T, P>(PhantomData<(&'a(),T,P)>); | |
19 | struct SplitsN<I>(PhantomData<I>); | |
1a4d82fc JJ |
20 | |
21 | trait SliceExt2 { | |
22 | type Item; | |
23 | ||
24 | fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> | |
25 | where P: FnMut(&Self::Item) -> bool; | |
85aaf69f | 26 | fn splitn2<'a, P>(&'a self, n: usize, pred: P) -> SplitsN<Splits<'a, Self::Item, P>> |
1a4d82fc JJ |
27 | where P: FnMut(&Self::Item) -> bool; |
28 | } | |
29 | ||
30 | impl<T> SliceExt2 for [T] { | |
31 | type Item = T; | |
32 | ||
33 | fn split2<P>(&self, pred: P) -> Splits<T, P> where P: FnMut(&T) -> bool { | |
34 | loop {} | |
35 | } | |
36 | ||
85aaf69f | 37 | fn splitn2<P>(&self, n: usize, pred: P) -> SplitsN<Splits<T, P>> where P: FnMut(&T) -> bool { |
1a4d82fc JJ |
38 | self.split2(pred); |
39 | loop {} | |
40 | } | |
41 | } | |
42 | ||
43 | fn main() { } |