Skip to content

Commit e09fc03

Browse files
committed
Various minor cases where errors are reported in slightly different ways.
1 parent 7f8ca53 commit e09fc03

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

src/test/compile-fail/issue-7575.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,24 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// Test the mechanism for warning about possible missing `self` declarations.
12+
1113
trait CtxtFn {
1214
fn f8(self, uint) -> uint;
13-
fn f9(uint) -> uint; //~ NOTE candidate #
15+
fn f9(uint) -> uint; //~ NOTE candidate
1416
}
1517

1618
trait OtherTrait {
17-
fn f9(uint) -> uint; //~ NOTE candidate #
19+
fn f9(uint) -> uint; //~ NOTE candidate
1820
}
1921

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
2229
}
2330

2431
impl CtxtFn for uint {
@@ -40,13 +47,13 @@ impl OtherTrait for uint {
4047
struct MyInt(int);
4148

4249
impl MyInt {
43-
fn fff(i: int) -> int { //~ NOTE candidate #1 is `MyInt::fff`
50+
fn fff(i: int) -> int { //~ NOTE candidate
4451
i
4552
}
4653
}
4754

4855
trait ManyImplTrait {
49-
fn is_str() -> bool { //~ NOTE candidate #1 is
56+
fn is_str() -> bool { //~ NOTE candidate
5057
false
5158
}
5259
}

src/test/compile-fail/selftype-traittype.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait add {
1414
}
1515

1616
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
1818
}
1919

2020
fn main() {}

src/test/compile-fail/unique-pinned-nocopy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ impl Drop for r {
1919

2020
fn main() {
2121
let i = box r { b: true };
22-
let _j = i.clone(); //~ ERROR not implemented
22+
let _j = i.clone(); //~ ERROR not implement
2323
println!("{}", i);
2424
}

src/test/compile-fail/unique-vec-res.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ fn main() {
3535
let r1 = vec!(box r { i: i1 });
3636
let r2 = vec!(box r { i: i2 });
3737
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`
4040
println!("{}", (r2, i1.get()));
4141
println!("{}", (r1, i2.get()));
4242
}

src/test/compile-fail/vec-res-add.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[deriving(Show)]
1112
struct r {
1213
i:int
1314
}
@@ -23,7 +24,6 @@ fn main() {
2324
let i = vec!(r(0));
2425
let j = vec!(r(1));
2526
let k = i + j;
26-
//~^ ERROR not implemented
27+
//~^ ERROR binary operation `+` cannot be applied to type
2728
println!("{}", j);
28-
//~^ ERROR not implemented
2929
}

0 commit comments

Comments
 (0)