From d91323992c7597311d32867c89bc997a9f0c160d Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 5 Jan 2015 15:56:07 -0500 Subject: [PATCH] Fix fallout in tests. --- src/test/auxiliary/nested_item.rs | 8 ++++---- src/test/compile-fail/coherence-all-remote.rs | 4 ++-- src/test/compile-fail/issue-12028.rs | 19 ++++++++++--------- src/test/compile-fail/issue-13853-5.rs | 2 +- src/test/compile-fail/issue-16562.rs | 2 +- src/test/run-pass/issue-3743.rs | 12 +++++++++--- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/test/auxiliary/nested_item.rs b/src/test/auxiliary/nested_item.rs index 1a2f429c9eb..21784bda27a 100644 --- a/src/test/auxiliary/nested_item.rs +++ b/src/test/auxiliary/nested_item.rs @@ -18,8 +18,8 @@ pub fn foo() -> int { // issue 8134 struct Foo; -impl Foo { - pub fn foo(&self) { +impl Foo { + pub fn foo(&self) { static X: uint = 1; } } @@ -33,8 +33,8 @@ impl> Parser { } struct Bar; -impl Foo { - pub fn bar(&self) { +impl Foo { + pub fn bar(&self) { static X: uint = 1; } } diff --git a/src/test/compile-fail/coherence-all-remote.rs b/src/test/compile-fail/coherence-all-remote.rs index d88b8751ea7..d86256a7776 100644 --- a/src/test/compile-fail/coherence-all-remote.rs +++ b/src/test/compile-fail/coherence-all-remote.rs @@ -11,9 +11,9 @@ // aux-build:coherence-lib.rs extern crate "coherence-lib" as lib; -use lib::Remote; +use lib::Remote1; -impl Remote for int { } +impl Remote1 for int { } //~^ ERROR E0117 fn main() { } diff --git a/src/test/compile-fail/issue-12028.rs b/src/test/compile-fail/issue-12028.rs index 78502efdec5..24ffc5e9ee3 100644 --- a/src/test/compile-fail/issue-12028.rs +++ b/src/test/compile-fail/issue-12028.rs @@ -22,27 +22,28 @@ trait Stream { fn result(&self) -> u64; } -trait StreamHasher { - fn stream(&self) -> S; +trait StreamHasher { + type S : Stream; + fn stream(&self) -> Self::S; } ////////////////////////////////////////////////////////////////////////////// -trait StreamHash>: Hash { - fn input_stream(&self, stream: &mut S); +trait StreamHash: Hash { + fn input_stream(&self, stream: &mut H::S); } -impl> Hash for u8 { +impl Hash 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> StreamHash for u8 { - fn input_stream(&self, stream: &mut S) { - stream.input(&[*self]); +impl StreamHash for u8 { + fn input_stream(&self, stream: &mut H::S) { + Stream::input(&*stream, &[*self]); } } diff --git a/src/test/compile-fail/issue-13853-5.rs b/src/test/compile-fail/issue-13853-5.rs index b3a4f341f84..6a017f7bb30 100644 --- a/src/test/compile-fail/issue-13853-5.rs +++ b/src/test/compile-fail/issue-13853-5.rs @@ -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>(_x: D, _y: &'a str) -> &'a str { } } diff --git a/src/test/compile-fail/issue-16562.rs b/src/test/compile-fail/issue-16562.rs index 3c784c3b770..626a442a2c3 100644 --- a/src/test/compile-fail/issue-16562.rs +++ b/src/test/compile-fail/issue-16562.rs @@ -18,7 +18,7 @@ struct Col { trait Collection { fn len(&self) -> uint; } impl Collection for Col { -//~^ ERROR unable to infer enough type information +//~^ ERROR type parameter `T` is not constrained fn len(&self) -> uint { unimplemented!() } diff --git a/src/test/run-pass/issue-3743.rs b/src/test/run-pass/issue-3743.rs index 43852fb3324..382ea0c5758 100644 --- a/src/test/run-pass/issue-3743.rs +++ b/src/test/run-pass/issue-3743.rs @@ -30,17 +30,23 @@ impl Vec2 { } // Right-hand-side operator visitor pattern -trait RhsOfVec2Mul { 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> Mul for Vec2 { +impl> Mul 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 for f64 { +impl RhsOfVec2Mul for f64 { + type Result = Vec2; + fn mul_vec2_by(&self, lhs: &Vec2) -> Vec2 { lhs.vmul(*self) } }