Various minor cases where errors are reported in slightly different ways.

This commit is contained in:
Niko Matsakis 2014-10-17 09:12:25 -04:00
parent 7f8ca53669
commit e09fc03701
5 changed files with 19 additions and 12 deletions

View File

@ -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 {
@ -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
}
}

View File

@ -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() {}

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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
}
@ -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
}