Skip to content

Commit 00c70d1

Browse files
committed
librustc: Allow the new UFCS explicit self in trait definitions, and
remove `~self` from the test suite.
1 parent fe49cbe commit 00c70d1

22 files changed

+31
-31
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ impl Clean<Item> for ty::Method {
10031003
};
10041004
let s = match s {
10051005
ty::ByReferenceExplicitSelfCategory(..) => {
1006-
match ty::get(*self.fty.sig.inputs[0]).sty {
1006+
match ty::get(self.fty.sig.inputs[0]).sty {
10071007
ty::ty_rptr(r, mt) => {
10081008
SelfBorrowed(r.clean(), mt.mutbl.clean())
10091009
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// error-pattern: type `&Foo` does not implement any method in scope named `foo`
1212

1313
trait Foo {
14-
fn foo(~self);
14+
fn foo(self: Box<Self>);
1515
}
1616

1717
impl Foo for int {
18-
fn foo(~self) { }
18+
fn foo(self: Box<int>) { }
1919
}
2020

2121
fn main() {

src/test/compile-fail/lint-unused-mut-self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
struct Foo;
1717
impl Foo {
1818
fn foo(mut self) {} //~ ERROR: variable does not need to be mutable
19-
fn bar(mut ~self) {} //~ ERROR: variable does not need to be mutable
19+
fn bar(mut self: Box<Foo>) {} //~ ERROR: variable does not need to be mutable
2020
}
2121

2222
fn main() {}

src/test/compile-fail/object-pointer-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait Foo {
1313
fn borrowed(&self);
1414
fn borrowed_mut(&mut self);
1515

16-
fn owned(~self);
16+
fn owned(self: Box<Self>);
1717
}
1818

1919
fn borrowed_receiver(x: &Foo) {

src/test/debuginfo/generic-method-on-generic-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<T1> Struct<T1> {
134134
arg1
135135
}
136136

137-
fn self_owned<T2>(~self, arg1: int, arg2: T2) -> int {
137+
fn self_owned<T2>(self: Box<Struct<T1>>, arg1: int, arg2: T2) -> int {
138138
zzz(); // #break
139139
arg1
140140
}

src/test/debuginfo/method-on-enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl Enum {
136136
arg1 + arg2
137137
}
138138

139-
fn self_owned(~self, arg1: int, arg2: int) -> int {
139+
fn self_owned(self: Box<Enum>, arg1: int, arg2: int) -> int {
140140
zzz(); // #break
141141
arg1 + arg2
142142
}

src/test/debuginfo/method-on-generic-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<T> Struct<T> {
134134
arg1 + arg2
135135
}
136136

137-
fn self_owned(~self, arg1: int, arg2: int) -> int {
137+
fn self_owned(self: Box<Struct<T>>, arg1: int, arg2: int) -> int {
138138
zzz(); // #break
139139
arg1 + arg2
140140
}

src/test/debuginfo/method-on-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl Struct {
133133
self.x + arg1 + arg2
134134
}
135135

136-
fn self_owned(~self, arg1: int, arg2: int) -> int {
136+
fn self_owned(self: Box<Struct>, arg1: int, arg2: int) -> int {
137137
zzz(); // #break
138138
self.x + arg1 + arg2
139139
}

src/test/debuginfo/method-on-trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct Struct {
124124
trait Trait {
125125
fn self_by_ref(&self, arg1: int, arg2: int) -> int;
126126
fn self_by_val(self, arg1: int, arg2: int) -> int;
127-
fn self_owned(~self, arg1: int, arg2: int) -> int;
127+
fn self_owned(self: Box<Self>, arg1: int, arg2: int) -> int;
128128
}
129129

130130
impl Trait for Struct {
@@ -139,7 +139,7 @@ impl Trait for Struct {
139139
self.x + arg1 + arg2
140140
}
141141

142-
fn self_owned(~self, arg1: int, arg2: int) -> int {
142+
fn self_owned(self: Box<Struct>, arg1: int, arg2: int) -> int {
143143
zzz(); // #break
144144
self.x + arg1 + arg2
145145
}

src/test/debuginfo/method-on-tuple-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl TupleStruct {
131131
arg1 + arg2
132132
}
133133

134-
fn self_owned(~self, arg1: int, arg2: int) -> int {
134+
fn self_owned(self: Box<TupleStruct>, arg1: int, arg2: int) -> int {
135135
zzz(); // #break
136136
arg1 + arg2
137137
}

0 commit comments

Comments
 (0)