Skip to content

Commit

Permalink
Fix fallout in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Jan 6, 2015
1 parent 2375a79 commit d913239
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/test/auxiliary/nested_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
}
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/coherence-all-remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
19 changes: 10 additions & 9 deletions src/test/compile-fail/issue-12028.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-13853-5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-16562.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/run-pass/issue-3743.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}

Expand Down

0 comments on commit d913239

Please sign in to comment.