librustc: Remove implicit self from the language, except for old-style drop blocks.
This commit is contained in:
parent
a410652bc9
commit
8fa66e8e07
133 changed files with 339 additions and 395 deletions
|
|
@ -9,6 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait me {
|
||||
fn me() -> uint;
|
||||
fn me(&self) -> uint;
|
||||
}
|
||||
impl me for uint { fn me() -> uint { self } }
|
||||
impl me for uint { fn me(&self) -> uint { self } }
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub mod kitties {
|
|||
}
|
||||
|
||||
pub impl cat {
|
||||
fn speak() {}
|
||||
fn speak(&self) {}
|
||||
}
|
||||
|
||||
pub fn cat(in_x : uint, in_y : int) -> cat {
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
#[link(name="cci_impl_lib", vers="0.0")];
|
||||
|
||||
trait uint_helpers {
|
||||
fn to(v: uint, f: &fn(uint));
|
||||
fn to(self, v: uint, f: &fn(uint));
|
||||
}
|
||||
|
||||
impl uint_helpers for uint {
|
||||
#[inline]
|
||||
fn to(v: uint, f: &fn(uint)) {
|
||||
fn to(self, v: uint, f: &fn(uint)) {
|
||||
let mut i = self;
|
||||
while i < v {
|
||||
f(i);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ pub mod name_pool {
|
|||
pub type name_pool = ();
|
||||
|
||||
pub trait add {
|
||||
fn add(s: ~str);
|
||||
fn add(&self, s: ~str);
|
||||
}
|
||||
|
||||
impl add for name_pool {
|
||||
fn add(s: ~str) {
|
||||
fn add(&self, s: ~str) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -31,11 +31,11 @@ pub mod rust {
|
|||
pub type rt = @();
|
||||
|
||||
pub trait cx {
|
||||
fn cx();
|
||||
fn cx(&self);
|
||||
}
|
||||
|
||||
impl cx for rt {
|
||||
fn cx() {
|
||||
fn cx(&self) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
type t1 = uint;
|
||||
|
||||
trait foo {
|
||||
fn foo();
|
||||
fn foo(&self);
|
||||
}
|
||||
|
||||
impl foo for ~str {
|
||||
fn foo() {}
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,5 +56,5 @@ fn context_res() -> context_res {
|
|||
pub type context = arc_destruct<context_res>;
|
||||
|
||||
pub impl context {
|
||||
fn socket() { }
|
||||
fn socket(&self) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@
|
|||
pub struct S(());
|
||||
|
||||
pub impl S {
|
||||
fn foo() { }
|
||||
fn foo(&self) { }
|
||||
}
|
||||
|
||||
pub trait T {
|
||||
fn bar();
|
||||
fn bar(&self);
|
||||
}
|
||||
|
||||
impl T for S {
|
||||
fn bar() { }
|
||||
fn bar(&self) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
trait x {
|
||||
fn use_x<T>();
|
||||
fn use_x<T>(&self);
|
||||
}
|
||||
struct y(());
|
||||
impl x for y {
|
||||
fn use_x<T>() {
|
||||
fn use_x<T>(&self) {
|
||||
struct foo { //~ ERROR quux
|
||||
i: ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub trait Foo { fn f() -> int; }
|
||||
pub trait Bar { fn g() -> int; }
|
||||
pub trait Baz { fn h() -> int; }
|
||||
pub trait Foo { fn f(&self) -> int; }
|
||||
pub trait Bar { fn g(&self) -> int; }
|
||||
pub trait Baz { fn h(&self) -> int; }
|
||||
|
||||
pub struct A { x: int }
|
||||
|
||||
impl Foo for A { fn f() -> int { 10 } }
|
||||
impl Bar for A { fn g() -> int { 20 } }
|
||||
impl Baz for A { fn h() -> int { 30 } }
|
||||
impl Foo for A { fn f(&self) -> int { 10 } }
|
||||
impl Bar for A { fn g(&self) -> int { 20 } }
|
||||
impl Baz for A { fn h(&self) -> int { 30 } }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
trait Foo { fn f() -> int; }
|
||||
trait Bar { fn g() -> int; }
|
||||
trait Baz { fn h() -> int; }
|
||||
trait Foo { fn f(&self) -> int; }
|
||||
trait Bar { fn g(&self) -> int; }
|
||||
trait Baz { fn h(&self) -> int; }
|
||||
|
||||
trait Quux: Foo + Bar + Baz { }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
pub trait Foo {
|
||||
fn f() -> int;
|
||||
fn f(&self) -> int;
|
||||
}
|
||||
|
||||
pub struct A {
|
||||
|
|
@ -18,5 +18,5 @@ pub struct A {
|
|||
}
|
||||
|
||||
impl Foo for A {
|
||||
fn f() -> int { 10 }
|
||||
fn f(&self) -> int { 10 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue