Fix fallout in tests.

This commit is contained in:
Niko Matsakis 2015-01-05 15:56:07 -05:00
parent 2375a79152
commit d91323992c
6 changed files with 27 additions and 20 deletions

View File

@ -18,8 +18,8 @@ pub fn foo<T>() -> int {
// issue 8134
struct Foo;
impl<T> Foo {
pub fn foo(&self) {
impl Foo {
pub fn foo<T>(&self) {
static X: uint = 1;
}
}
@ -33,8 +33,8 @@ impl<T: std::iter::Iterator<Item=char>> Parser<T> {
}
struct Bar;
impl<T> Foo {
pub fn bar(&self) {
impl Foo {
pub fn bar<T>(&self) {
static X: uint = 1;
}
}

View File

@ -11,9 +11,9 @@
// aux-build:coherence-lib.rs
extern crate "coherence-lib" as lib;
use lib::Remote;
use lib::Remote1;
impl<T> Remote for int { }
impl<T> Remote1<T> for int { }
//~^ ERROR E0117
fn main() { }

View File

@ -22,27 +22,28 @@ trait Stream {
fn result(&self) -> u64;
}
trait StreamHasher<S: Stream> {
fn stream(&self) -> S;
trait StreamHasher {
type S : Stream;
fn stream(&self) -> Self::S;
}
//////////////////////////////////////////////////////////////////////////////
trait StreamHash<S: Stream, H: StreamHasher<S>>: Hash<H> {
fn input_stream(&self, stream: &mut S);
trait StreamHash<H: StreamHasher>: Hash<H> {
fn input_stream(&self, stream: &mut H::S);
}
impl<S: Stream, H: StreamHasher<S>> Hash<H> for u8 {
impl<H: StreamHasher> Hash<H> for u8 {
fn hash2(&self, hasher: &H) -> u64 {
let mut stream = hasher.stream();
self.input_stream(&mut stream); //~ ERROR type annotations required
stream.result()
Stream::result(&stream)
}
}
impl<S: Stream, H: StreamHasher<S>> StreamHash<S, H> for u8 {
fn input_stream(&self, stream: &mut S) {
stream.input(&[*self]);
impl<H: StreamHasher> StreamHash<H> for u8 {
fn input_stream(&self, stream: &mut H::S) {
Stream::input(&*stream, &[*self]);
}
}

View File

@ -15,7 +15,7 @@ trait Deserializable {
}
impl<'a, T: Deserializable> Deserializable for &'a str {
//~^ ERROR unable to infer enough type information
//~^ ERROR type parameter `T` is not constrained
fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
}
}

View File

@ -18,7 +18,7 @@ struct Col<D, C> {
trait Collection { fn len(&self) -> uint; }
impl<T, M: MatrixShape> Collection for Col<M, uint> {
//~^ ERROR unable to infer enough type information
//~^ ERROR type parameter `T` is not constrained
fn len(&self) -> uint {
unimplemented!()
}

View File

@ -30,17 +30,23 @@ impl Vec2 {
}
// Right-hand-side operator visitor pattern
trait RhsOfVec2Mul<Result> { fn mul_vec2_by(&self, lhs: &Vec2) -> Result; }
trait RhsOfVec2Mul {
type Result;
fn mul_vec2_by(&self, lhs: &Vec2) -> Self::Result;
}
// Vec2's implementation of Mul "from the other side" using the above trait
impl<Res, Rhs: RhsOfVec2Mul<Res>> Mul<Rhs> for Vec2 {
impl<Res, Rhs: RhsOfVec2Mul<Result=Res>> Mul<Rhs> for Vec2 {
type Output = Res;
fn mul(self, rhs: Rhs) -> Res { rhs.mul_vec2_by(&self) }
}
// Implementation of 'f64 as right-hand-side of Vec2::Mul'
impl RhsOfVec2Mul<Vec2> for f64 {
impl RhsOfVec2Mul for f64 {
type Result = Vec2;
fn mul_vec2_by(&self, lhs: &Vec2) -> Vec2 { lhs.vmul(*self) }
}