]> git.lizzy.rs Git - rust.git/blob - src/test/ui/typeck/issue-13853.rs
Rollup merge of #100789 - compiler-errors:issue-99662, r=spastorino
[rust.git] / src / test / ui / typeck / issue-13853.rs
1 trait Node {
2     fn zomg();
3 }
4
5 trait Graph<N: Node> {
6     fn nodes<'a, I: Iterator<Item=&'a N>>(&'a self) -> I
7         where N: 'a;
8 }
9
10 impl<N: Node> Graph<N> for Vec<N> {
11     fn nodes<'a, I: Iterator<Item=&'a N>>(&self) -> I
12         where N: 'a
13     {
14         self.iter() //~ ERROR mismatched types
15     }
16 }
17
18 struct Stuff;
19
20 impl Node for Stuff {
21     fn zomg() {
22         println!("zomg");
23     }
24 }
25
26 fn iterate<N: Node, G: Graph<N>>(graph: &G) {
27     for node in graph.iter() { //~ ERROR no method named `iter` found
28         node.zomg();
29     }
30 }
31
32 pub fn main() {
33     let graph = Vec::new();
34
35     graph.push(Stuff);
36
37     iterate(graph); //~ ERROR mismatched types
38 }