提交 e09fc037 编写于 作者: N Niko Matsakis

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

上级 7f8ca536
......@@ -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 @@ fn f9(i: uint) -> 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
}
}
......
......@@ -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() {}
......@@ -19,6 +19,6 @@ fn drop(&mut self) {}
fn main() {
let i = box r { b: true };
let _j = i.clone(); //~ ERROR not implemented
let _j = i.clone(); //~ ERROR not implement
println!("{}", i);
}
......@@ -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()));
}
......@@ -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
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册