parent
7a758d188a
commit
9cd7864147
16
src/test/compile-fail/issue-13853-2.rs
Normal file
16
src/test/compile-fail/issue-13853-2.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait FromStructReader<'a> { }
|
||||
trait ResponseHook {
|
||||
fn get<'a, T: FromStructReader<'a>>(&'a self);
|
||||
}
|
||||
fn foo(res : Box<ResponseHook>) { res.get } //~ ERROR attempted to take value of method
|
||||
fn main() {}
|
33
src/test/compile-fail/issue-13853-3.rs
Normal file
33
src/test/compile-fail/issue-13853-3.rs
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
enum NodeContents<'a> {
|
||||
Children(Vec<Node<'a>>),
|
||||
}
|
||||
|
||||
impl<'a> Drop for NodeContents<'a> {
|
||||
//~^ ERROR cannot implement a destructor on a structure with type parameters
|
||||
fn drop( &mut self ) {
|
||||
}
|
||||
}
|
||||
|
||||
struct Node<'a> {
|
||||
contents: NodeContents<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Node<'a> {
|
||||
fn noName(contents: NodeContents<'a>) -> Node<'a> {
|
||||
Node{ contents: contents,}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
21
src/test/compile-fail/issue-13853-4.rs
Normal file
21
src/test/compile-fail/issue-13853-4.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct AutoBuilder<'a> {
|
||||
context: &'a int
|
||||
}
|
||||
|
||||
impl<'a> Drop for AutoBuilder<'a> {
|
||||
//~^ ERROR cannot implement a destructor on a structure with type parameters
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
23
src/test/compile-fail/issue-13853-5.rs
Normal file
23
src/test/compile-fail/issue-13853-5.rs
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait Deserializer<'a> { }
|
||||
|
||||
trait Deserializable {
|
||||
fn deserialize_token<'a, D: Deserializer<'a>>(D, &'a str) -> Self;
|
||||
}
|
||||
|
||||
impl<'a, T: Deserializable> Deserializable for &'a str {
|
||||
//~^ ERROR unable to infer enough type information
|
||||
fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
45
src/test/compile-fail/issue-13853.rs
Normal file
45
src/test/compile-fail/issue-13853.rs
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait Node {
|
||||
fn zomg();
|
||||
}
|
||||
|
||||
trait Graph<N: Node> {
|
||||
fn nodes<'a, I: Iterator<&'a N>>(&'a self) -> I;
|
||||
}
|
||||
|
||||
impl<N: Node> Graph<N> for Vec<N> {
|
||||
fn nodes<'a, I: Iterator<&'a N>>(&self) -> I {
|
||||
self.iter() //~ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
struct Stuff;
|
||||
|
||||
impl Node for Stuff {
|
||||
fn zomg() {
|
||||
println!("zomg");
|
||||
}
|
||||
}
|
||||
|
||||
fn iterate<N: Node, G: Graph<N>>(graph: &G) {
|
||||
for node in graph.iter() { //~ ERROR does not implement any method in scope named
|
||||
node.zomg();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let graph = Vec::new();
|
||||
|
||||
graph.push(Stuff);
|
||||
|
||||
iterate(graph); //~ ERROR mismatched types
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user