File tree 6 files changed +27
-20
lines changed
6 files changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ pub fn foo<T>() -> int {
18
18
19
19
// issue 8134
20
20
struct Foo ;
21
- impl < T > Foo {
22
- pub fn foo ( & self ) {
21
+ impl Foo {
22
+ pub fn foo < T > ( & self ) {
23
23
static X : uint = 1 ;
24
24
}
25
25
}
@@ -33,8 +33,8 @@ impl<T: std::iter::Iterator<Item=char>> Parser<T> {
33
33
}
34
34
35
35
struct Bar ;
36
- impl < T > Foo {
37
- pub fn bar ( & self ) {
36
+ impl Foo {
37
+ pub fn bar < T > ( & self ) {
38
38
static X : uint = 1 ;
39
39
}
40
40
}
Original file line number Diff line number Diff line change 11
11
// aux-build:coherence-lib.rs
12
12
13
13
extern crate "coherence-lib" as lib;
14
- use lib:: Remote ;
14
+ use lib:: Remote1 ;
15
15
16
- impl < T > Remote for int { }
16
+ impl < T > Remote1 < T > for int { }
17
17
//~^ ERROR E0117
18
18
19
19
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -22,27 +22,28 @@ trait Stream {
22
22
fn result ( & self ) -> u64 ;
23
23
}
24
24
25
- trait StreamHasher < S : Stream > {
26
- fn stream ( & self ) -> S ;
25
+ trait StreamHasher {
26
+ type S : Stream ;
27
+ fn stream ( & self ) -> Self :: S ;
27
28
}
28
29
29
30
//////////////////////////////////////////////////////////////////////////////
30
31
31
- trait StreamHash < S : Stream , H : StreamHasher < S > > : Hash < H > {
32
- fn input_stream ( & self , stream : & mut S ) ;
32
+ trait StreamHash < H : StreamHasher > : Hash < H > {
33
+ fn input_stream ( & self , stream : & mut H :: S ) ;
33
34
}
34
35
35
- impl < S : Stream , H : StreamHasher < S > > Hash < H > for u8 {
36
+ impl < H : StreamHasher > Hash < H > for u8 {
36
37
fn hash2 ( & self , hasher : & H ) -> u64 {
37
38
let mut stream = hasher. stream ( ) ;
38
39
self . input_stream ( & mut stream) ; //~ ERROR type annotations required
39
- stream . result ( )
40
+ Stream :: result ( & stream )
40
41
}
41
42
}
42
43
43
- impl < S : Stream , H : StreamHasher < S > > StreamHash < S , H > for u8 {
44
- fn input_stream ( & self , stream : & mut S ) {
45
- stream . input ( & [ * self ] ) ;
44
+ impl < H : StreamHasher > StreamHash < H > for u8 {
45
+ fn input_stream ( & self , stream : & mut H :: S ) {
46
+ Stream :: input ( & * stream , & [ * self ] ) ;
46
47
}
47
48
}
48
49
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ trait Deserializable {
15
15
}
16
16
17
17
impl < ' a , T : Deserializable > Deserializable for & ' a str {
18
- //~^ ERROR unable to infer enough type information
18
+ //~^ ERROR type parameter `T` is not constrained
19
19
fn deserialize_token < D : Deserializer < ' a > > ( _x : D , _y : & ' a str ) -> & ' a str {
20
20
}
21
21
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ struct Col<D, C> {
18
18
trait Collection { fn len ( & self ) -> uint ; }
19
19
20
20
impl < T , M : MatrixShape > Collection for Col < M , uint > {
21
- //~^ ERROR unable to infer enough type information
21
+ //~^ ERROR type parameter `T` is not constrained
22
22
fn len ( & self ) -> uint {
23
23
unimplemented ! ( )
24
24
}
Original file line number Diff line number Diff line change @@ -30,17 +30,23 @@ impl Vec2 {
30
30
}
31
31
32
32
// Right-hand-side operator visitor pattern
33
- trait RhsOfVec2Mul < Result > { fn mul_vec2_by ( & self , lhs : & Vec2 ) -> Result ; }
33
+ trait RhsOfVec2Mul {
34
+ type Result ;
35
+
36
+ fn mul_vec2_by ( & self , lhs : & Vec2 ) -> Self :: Result ;
37
+ }
34
38
35
39
// Vec2's implementation of Mul "from the other side" using the above trait
36
- impl < Res , Rhs : RhsOfVec2Mul < Res > > Mul < Rhs > for Vec2 {
40
+ impl < Res , Rhs : RhsOfVec2Mul < Result = Res > > Mul < Rhs > for Vec2 {
37
41
type Output = Res ;
38
42
39
43
fn mul ( self , rhs : Rhs ) -> Res { rhs. mul_vec2_by ( & self ) }
40
44
}
41
45
42
46
// Implementation of 'f64 as right-hand-side of Vec2::Mul'
43
- impl RhsOfVec2Mul < Vec2 > for f64 {
47
+ impl RhsOfVec2Mul for f64 {
48
+ type Result = Vec2 ;
49
+
44
50
fn mul_vec2_by ( & self , lhs : & Vec2 ) -> Vec2 { lhs. vmul ( * self ) }
45
51
}
46
52
You can’t perform that action at this time.
0 commit comments