]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/trait-bounds-impl-comparison-2.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[rust.git] / src / test / compile-fail / trait-bounds-impl-comparison-2.rs
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 // Issue #5886: a complex instance of issue #2687.
12
13 trait Iterator<A> {
14     fn next(&mut self) -> Option<A>;
15 }
16
17 trait IteratorUtil<A>
18     : ::std::marker::PhantomFn<(),A>
19 {
20     fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
21 }
22
23 impl<A, T: Iterator<A>> IteratorUtil<A> for T {
24     fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
25     //~^ ERROR the requirement `U : Iterator<B>` appears on the impl method
26         ZipIterator{a: self, b: other}
27     }
28 }
29
30 struct ZipIterator<T, U> {
31     a: T, b: U
32 }
33
34 fn main() {}
35