]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/trait-bounds-impl-comparison-2.rs
Make RFC 1214 warnings into errors, and rip out the "warn or err"
[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>: Sized
18 {
19     fn zip<B, U: Iterator<U>>(self, other: U) -> ZipIterator<Self, U>;
20 }
21
22 impl<A, T: Iterator<A>> IteratorUtil<A> for T {
23     fn zip<B, U: Iterator<B>>(self, other: U) -> ZipIterator<T, U> {
24     //~^ ERROR the requirement `U : Iterator<B>` appears on the impl method
25         ZipIterator{a: self, b: other}
26     }
27 }
28
29 struct ZipIterator<T, U> {
30     a: T, b: U
31 }
32
33 fn main() {}