File tree 5 files changed +19
-12
lines changed
5 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ // Test the mechanism for warning about possible missing `self` declarations.
12
+
11
13
trait CtxtFn {
12
14
fn f8 ( self , uint ) -> uint ;
13
- fn f9 ( uint ) -> uint ; //~ NOTE candidate #
15
+ fn f9 ( uint ) -> uint ; //~ NOTE candidate
14
16
}
15
17
16
18
trait OtherTrait {
17
- fn f9 ( uint ) -> uint ; //~ NOTE candidate #
19
+ fn f9 ( uint ) -> uint ; //~ NOTE candidate
18
20
}
19
21
20
- trait UnusedTrait { // This should never show up as a candidate
21
- fn f9 ( uint ) -> uint ;
22
+ // Note: this trait is not implemented, but we can't really tell
23
+ // whether or not an impl would match anyhow without a self
24
+ // declaration to match against, so we wind up printing it as a
25
+ // candidate. This seems not unreasonable -- perhaps the user meant to
26
+ // implement it, after all.
27
+ trait UnusedTrait {
28
+ fn f9 ( uint ) -> uint ; //~ NOTE candidate
22
29
}
23
30
24
31
impl CtxtFn for uint {
@@ -40,13 +47,13 @@ impl OtherTrait for uint {
40
47
struct MyInt ( int ) ;
41
48
42
49
impl MyInt {
43
- fn fff ( i : int ) -> int { //~ NOTE candidate #1 is `MyInt::fff`
50
+ fn fff ( i : int ) -> int { //~ NOTE candidate
44
51
i
45
52
}
46
53
}
47
54
48
55
trait ManyImplTrait {
49
- fn is_str ( ) -> bool { //~ NOTE candidate #1 is
56
+ fn is_str ( ) -> bool { //~ NOTE candidate
50
57
false
51
58
}
52
59
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ trait add {
14
14
}
15
15
16
16
fn do_add ( x : Box < add +' static > , y : Box < add +' static > ) -> Box < add +' static > {
17
- x. plus ( y) //~ ERROR cannot call a method whose type contains a self-type through an object
17
+ x. plus ( y) //~ ERROR E0038
18
18
}
19
19
20
20
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -19,6 +19,6 @@ impl Drop for r {
19
19
20
20
fn main ( ) {
21
21
let i = box r { b : true } ;
22
- let _j = i. clone ( ) ; //~ ERROR not implemented
22
+ let _j = i. clone ( ) ; //~ ERROR not implement
23
23
println ! ( "{}" , i) ;
24
24
}
Original file line number Diff line number Diff line change @@ -35,8 +35,8 @@ fn main() {
35
35
let r1 = vec ! ( box r { i: i1 } ) ;
36
36
let r2 = vec ! ( box r { i: i2 } ) ;
37
37
f ( r1. clone ( ) , r2. clone ( ) ) ;
38
- //~^ ERROR the trait `core::clone::Clone` is not implemented
39
- //~^^ ERROR the trait `core::clone::Clone` is not implemented
38
+ //~^ ERROR does not implement any method in scope named `clone`
39
+ //~^^ ERROR does not implement any method in scope named `clone`
40
40
println ! ( "{}" , ( r2, i1. get( ) ) ) ;
41
41
println ! ( "{}" , ( r1, i2. get( ) ) ) ;
42
42
}
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ #[ deriving( Show ) ]
11
12
struct r {
12
13
i : int
13
14
}
@@ -23,7 +24,6 @@ fn main() {
23
24
let i = vec ! ( r( 0 ) ) ;
24
25
let j = vec ! ( r( 1 ) ) ;
25
26
let k = i + j;
26
- //~^ ERROR not implemented
27
+ //~^ ERROR binary operation `+` cannot be applied to type
27
28
println ! ( "{}" , j) ;
28
- //~^ ERROR not implemented
29
29
}
You can’t perform that action at this time.
0 commit comments