File tree Expand file tree Collapse file tree 6 files changed +27
-20
lines changed
Expand file tree Collapse file tree 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 {
1818
1919// issue 8134
2020struct Foo ;
21- impl < T > Foo {
22- pub fn foo ( & self ) {
21+ impl Foo {
22+ pub fn foo < T > ( & self ) {
2323 static X : uint = 1 ;
2424 }
2525}
@@ -33,8 +33,8 @@ impl<T: std::iter::Iterator<Item=char>> Parser<T> {
3333}
3434
3535struct Bar ;
36- impl < T > Foo {
37- pub fn bar ( & self ) {
36+ impl Foo {
37+ pub fn bar < T > ( & self ) {
3838 static X : uint = 1 ;
3939 }
4040}
Original file line number Diff line number Diff line change 1111// aux-build:coherence-lib.rs
1212
1313extern crate "coherence-lib" as lib;
14- use lib:: Remote ;
14+ use lib:: Remote1 ;
1515
16- impl < T > Remote for int { }
16+ impl < T > Remote1 < T > for int { }
1717//~^ ERROR E0117
1818
1919fn main ( ) { }
Original file line number Diff line number Diff line change @@ -22,27 +22,28 @@ trait Stream {
2222 fn result ( & self ) -> u64 ;
2323}
2424
25- trait StreamHasher < S : Stream > {
26- fn stream ( & self ) -> S ;
25+ trait StreamHasher {
26+ type S : Stream ;
27+ fn stream ( & self ) -> Self :: S ;
2728}
2829
2930//////////////////////////////////////////////////////////////////////////////
3031
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 ) ;
3334}
3435
35- impl < S : Stream , H : StreamHasher < S > > Hash < H > for u8 {
36+ impl < H : StreamHasher > Hash < H > for u8 {
3637 fn hash2 ( & self , hasher : & H ) -> u64 {
3738 let mut stream = hasher. stream ( ) ;
3839 self . input_stream ( & mut stream) ; //~ ERROR type annotations required
39- stream . result ( )
40+ Stream :: result ( & stream )
4041 }
4142}
4243
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 ] ) ;
4647 }
4748}
4849
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ trait Deserializable {
1515}
1616
1717impl < ' a , T : Deserializable > Deserializable for & ' a str {
18- //~^ ERROR unable to infer enough type information
18+ //~^ ERROR type parameter `T` is not constrained
1919 fn deserialize_token < D : Deserializer < ' a > > ( _x : D , _y : & ' a str ) -> & ' a str {
2020 }
2121}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ struct Col<D, C> {
1818trait Collection { fn len ( & self ) -> uint ; }
1919
2020impl < T , M : MatrixShape > Collection for Col < M , uint > {
21- //~^ ERROR unable to infer enough type information
21+ //~^ ERROR type parameter `T` is not constrained
2222 fn len ( & self ) -> uint {
2323 unimplemented ! ( )
2424 }
Original file line number Diff line number Diff line change @@ -30,17 +30,23 @@ impl Vec2 {
3030}
3131
3232// 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+ }
3438
3539// 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 {
3741 type Output = Res ;
3842
3943 fn mul ( self , rhs : Rhs ) -> Res { rhs. mul_vec2_by ( & self ) }
4044}
4145
4246// 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+
4450 fn mul_vec2_by ( & self , lhs : & Vec2 ) -> Vec2 { lhs. vmul ( * self ) }
4551}
4652
You can’t perform that action at this time.
0 commit comments