Skip to content

Commit

Permalink
Various minor cases where errors are reported in slightly different w…
Browse files Browse the repository at this point in the history
…ays.
  • Loading branch information
nikomatsakis committed Oct 21, 2014
1 parent 7f8ca53 commit e09fc03
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
19 changes: 13 additions & 6 deletions src/test/compile-fail/issue-7575.rs
Expand Up @@ -8,17 +8,24 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Test the mechanism for warning about possible missing `self` declarations.

trait CtxtFn {
fn f8(self, uint) -> uint;
fn f9(uint) -> uint; //~ NOTE candidate #
fn f9(uint) -> uint; //~ NOTE candidate
}

trait OtherTrait {
fn f9(uint) -> uint; //~ NOTE candidate #
fn f9(uint) -> uint; //~ NOTE candidate
}

trait UnusedTrait { // This should never show up as a candidate
fn f9(uint) -> uint;
// Note: this trait is not implemented, but we can't really tell
// whether or not an impl would match anyhow without a self
// declaration to match against, so we wind up printing it as a
// candidate. This seems not unreasonable -- perhaps the user meant to
// implement it, after all.
trait UnusedTrait {
fn f9(uint) -> uint; //~ NOTE candidate
}

impl CtxtFn for uint {
Expand All @@ -40,13 +47,13 @@ impl OtherTrait for uint {
struct MyInt(int);

impl MyInt {
fn fff(i: int) -> int { //~ NOTE candidate #1 is `MyInt::fff`
fn fff(i: int) -> int { //~ NOTE candidate
i
}
}

trait ManyImplTrait {
fn is_str() -> bool { //~ NOTE candidate #1 is
fn is_str() -> bool { //~ NOTE candidate
false
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/selftype-traittype.rs
Expand Up @@ -14,7 +14,7 @@ trait add {
}

fn do_add(x: Box<add+'static>, y: Box<add+'static>) -> Box<add+'static> {
x.plus(y) //~ ERROR cannot call a method whose type contains a self-type through an object
x.plus(y) //~ ERROR E0038
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/unique-pinned-nocopy.rs
Expand Up @@ -19,6 +19,6 @@ impl Drop for r {

fn main() {
let i = box r { b: true };
let _j = i.clone(); //~ ERROR not implemented
let _j = i.clone(); //~ ERROR not implement
println!("{}", i);
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/unique-vec-res.rs
Expand Up @@ -35,8 +35,8 @@ fn main() {
let r1 = vec!(box r { i: i1 });
let r2 = vec!(box r { i: i2 });
f(r1.clone(), r2.clone());
//~^ ERROR the trait `core::clone::Clone` is not implemented
//~^^ ERROR the trait `core::clone::Clone` is not implemented
//~^ ERROR does not implement any method in scope named `clone`
//~^^ ERROR does not implement any method in scope named `clone`
println!("{}", (r2, i1.get()));
println!("{}", (r1, i2.get()));
}
4 changes: 2 additions & 2 deletions src/test/compile-fail/vec-res-add.rs
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[deriving(Show)]
struct r {
i:int
}
Expand All @@ -23,7 +24,6 @@ fn main() {
let i = vec!(r(0));
let j = vec!(r(1));
let k = i + j;
//~^ ERROR not implemented
//~^ ERROR binary operation `+` cannot be applied to type
println!("{}", j);
//~^ ERROR not implemented
}

0 comments on commit e09fc03

Please sign in to comment.