File tree Expand file tree Collapse file tree 5 files changed +138
-0
lines changed Expand file tree Collapse file tree 5 files changed +138
-0
lines changed Original file line number Diff line number Diff line change 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+ trait FromStructReader<'a> { }
12+ trait ResponseHook {
13+ fn get<'a, T: FromStructReader<'a>>(&'a self);
14+ }
15+ fn foo(res : Box<ResponseHook>) { res.get } //~ ERROR attempted to take value of method
16+ fn main() {}
Original file line number Diff line number Diff line change 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+ #![crate_type = "lib"]
12+
13+ enum NodeContents<'a> {
14+ Children(Vec<Node<'a>>),
15+ }
16+
17+ impl<'a> Drop for NodeContents<'a> {
18+ //~^ ERROR cannot implement a destructor on a structure with type parameters
19+ fn drop( &mut self ) {
20+ }
21+ }
22+
23+ struct Node<'a> {
24+ contents: NodeContents<'a>,
25+ }
26+
27+ impl<'a> Node<'a> {
28+ fn noName(contents: NodeContents<'a>) -> Node<'a> {
29+ Node{ contents: contents,}
30+ }
31+ }
32+
33+ fn main() {}
Original file line number Diff line number Diff line change 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+ struct AutoBuilder<'a> {
12+ context: &'a int
13+ }
14+
15+ impl<'a> Drop for AutoBuilder<'a> {
16+ //~^ ERROR cannot implement a destructor on a structure with type parameters
17+ fn drop(&mut self) {
18+ }
19+ }
20+
21+ fn main() {}
Original file line number Diff line number Diff line change 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+ trait Deserializer<'a> { }
12+
13+ trait Deserializable {
14+ fn deserialize_token<'a, D: Deserializer<'a>>(D, &'a str) -> Self;
15+ }
16+
17+ impl<'a, T: Deserializable> Deserializable for &'a str {
18+ //~^ ERROR unable to infer enough type information
19+ fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
20+ }
21+ }
22+
23+ fn main() {}
Original file line number Diff line number Diff line change 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+ trait Node {
12+ fn zomg();
13+ }
14+
15+ trait Graph<N: Node> {
16+ fn nodes<'a, I: Iterator<&'a N>>(&'a self) -> I;
17+ }
18+
19+ impl<N: Node> Graph<N> for Vec<N> {
20+ fn nodes<'a, I: Iterator<&'a N>>(&self) -> I {
21+ self.iter() //~ ERROR mismatched types
22+ }
23+ }
24+
25+ struct Stuff;
26+
27+ impl Node for Stuff {
28+ fn zomg() {
29+ println!("zomg");
30+ }
31+ }
32+
33+ fn iterate<N: Node, G: Graph<N>>(graph: &G) {
34+ for node in graph.iter() { //~ ERROR does not implement any method in scope named
35+ node.zomg();
36+ }
37+ }
38+
39+ pub fn main() {
40+ let graph = Vec::new();
41+
42+ graph.push(Stuff);
43+
44+ iterate(graph); //~ ERROR mismatched types
45+ }
You can’t perform that action at this time.
0 commit comments