]> git.lizzy.rs Git - rust.git/commitdiff
Fix fallout in tests.
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 5 Jan 2015 20:56:07 +0000 (15:56 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 6 Jan 2015 22:17:49 +0000 (17:17 -0500)
src/test/auxiliary/nested_item.rs
src/test/compile-fail/coherence-all-remote.rs
src/test/compile-fail/issue-12028.rs
src/test/compile-fail/issue-13853-5.rs
src/test/compile-fail/issue-16562.rs
src/test/run-pass/issue-3743.rs

index 1a2f429c9ebc1c31b32d2923d1ec915b304458b9..21784bda27a8f14e5e3a0e37a4c8529548d257e4 100644 (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 @@ fn in_doctype(&mut self) {
 }
 
 struct Bar;
-impl<T> Foo {
-    pub fn bar(&self) {
+impl Foo {
+    pub fn bar<T>(&self) {
         static X: uint = 1;
     }
 }
index d88b8751ea7b02c495329b51a5a569a2924572ae..d86256a77765ee99153f57cd0a261e44fda827eb 100644 (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() { }
index 78502efdec520f17d762af200a251fa09e36e0ee..24ffc5e9ee373de30f2b032561cd17ad8e0fa984 100644 (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]);
     }
 }
 
index b3a4f341f8448f30aa6b76221d14fb31dbd23b39..6a017f7bb30c1bda6de09eb42c00331fce6736fb 100644 (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 {
     }
 }
index 3c784c3b770e4f847884dcedc12b5bf86e040b4c..626a442a2c355aed067f28a1af4293f34f284f73 100644 (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!()
     }
index 43852fb33240090ddadb1314559108aa80ad0d64..382ea0c575887cc9ddc72ebcd47072eec8210159 100644 (file)
@@ -30,17 +30,23 @@ fn vmul(self, other: f64) -> 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) }
 }