forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regression tests for rust-lang#13853
Closes rust-lang#13853, rust-lang#14889.
- Loading branch information
Showing
5 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |