Skip to content

Commit f60cdf2

Browse files
committed
Remove 'implements' keyword in favour of :, part of #2301.
1 parent 3ed8561 commit f60cdf2

17 files changed

+21
-20
lines changed

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ class parser {
19791979
let rp = self.parse_region_param();
19801980
let ty_params = self.parse_ty_params();
19811981
let class_path = self.ident_to_path_tys(class_name, rp, ty_params);
1982-
let ifaces : [@iface_ref] = if self.eat_keyword("implements")
1982+
let ifaces : [@iface_ref] = if self.eat(token::COLON)
19831983
{ self.parse_iface_ref_list() }
19841984
else { [] };
19851985
self.expect(token::LBRACE);

src/libsyntax/parse/token.rs

-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> {
251251
let keys = [
252252
"as",
253253
"else",
254-
"implements",
255254
"move",
256255
"of",
257256
"priv", "pub",

src/libsyntax/print/pprust.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,11 @@ fn print_item(s: ps, &&item: @ast::item) {
527527
word_nbsp(s, *item.ident);
528528
print_region_param(s, rp);
529529
print_type_params(s, tps);
530-
word_space(s, "implements");
531-
commasep(s, inconsistent, ifaces, {|s, p|
532-
print_path(s, p.path, false)});
530+
if vec::len(ifaces) != 0u {
531+
word_space(s, ":");
532+
commasep(s, inconsistent, ifaces, {|s, p|
533+
print_path(s, p.path, false)});
534+
}
533535
bopen(s);
534536
hardbreak_if_not_bol(s);
535537
maybe_print_comment(s, ctor.span.lo);

src/test/auxiliary/cci_class_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import to_str::to_str;
33

44
mod kitty {
55

6-
class cat implements to_str {
6+
class cat : to_str {
77
priv {
88
let mut meows : uint;
99
fn meow() {

src/test/compile-fail/class-cast-to-iface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ iface noisy {
33
fn speak();
44
}
55

6-
class cat implements noisy {
6+
class cat : noisy {
77
priv {
88
let mut meows : uint;
99
fn meow() {

src/test/compile-fail/class-implements-bad-iface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// error-pattern:unresolved typename: nonexistent
2-
class cat implements nonexistent {
2+
class cat : nonexistent {
33
let meows: uint;
44
new(in_x : uint) { self.meows = in_x; }
55
}

src/test/compile-fail/class-implements-int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class cat implements int { //! ERROR can only implement interface types
1+
class cat : int { //! ERROR can only implement interface types
22
let meows: uint;
33
new(in_x : uint) { self.meows = in_x; }
44
}

src/test/compile-fail/class-method-missing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ iface animal {
33
fn eat();
44
}
55

6-
class cat implements animal {
6+
class cat : animal {
77
let meows: uint;
88
new(in_x : uint) { self.meows = in_x; }
99
}

src/test/run-pass/class-cast-to-iface-cross-crate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import to_str::*;
22
import to_str::to_str;
33

4-
class cat implements to_str {
4+
class cat : to_str {
55
priv {
66
let mut meows : uint;
77
fn meow() {

src/test/run-pass/class-cast-to-iface-multiple-types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ iface noisy {
22
fn speak() -> int;
33
}
44

5-
class dog implements noisy {
5+
class dog : noisy {
66
priv {
77
let barks : @mut uint;
88
fn bark() -> int {
@@ -26,7 +26,7 @@ class dog implements noisy {
2626
fn speak() -> int { self.bark() }
2727
}
2828

29-
class cat implements noisy {
29+
class cat : noisy {
3030
priv {
3131
let meows : @mut uint;
3232
fn meow() -> uint {

src/test/run-pass/class-cast-to-iface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ iface noisy {
22
fn speak();
33
}
44

5-
class cat implements noisy {
5+
class cat : noisy {
66
priv {
77
let mut meows : uint;
88
fn meow() {

src/test/run-pass/class-iface-bounded-param.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std;
22
import std::map::{map, hashmap, int_hash};
33

44
class keys<K: copy, V: copy, M: copy map<K,V>>
5-
implements iter::base_iter<K> {
5+
: iter::base_iter<K> {
66

77
let map: M;
88

src/test/run-pass/class-impl-parameterized-iface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std;
33
import std::map::*;
44

5-
class cat implements map<int, bool> {
5+
class cat : map<int, bool> {
66
priv {
77
// Yes, you can have negative meows
88
let mut meows : int;

src/test/run-pass/class-impl-very-parameterized-iface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enum cat_type { tuxedo, tabby, tortoiseshell }
77
// for any int value that's less than the meows field
88

99
// ok: T should be in scope when resolving the iface ref for map
10-
class cat<T: copy> implements map<int, T> {
10+
class cat<T: copy> : map<int, T> {
1111
priv {
1212
// Yes, you can have negative meows
1313
let mut meows : int;

src/test/run-pass/class-implement-iface-cross-crate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use cci_class_iface;
44
import cci_class_iface::animals::*;
55

6-
class cat implements noisy {
6+
class cat : noisy {
77
priv {
88
let mut meows : uint;
99
fn meow() {

src/test/run-pass/class-implement-ifaces.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ iface noisy {
22
fn speak();
33
}
44

5-
class cat implements noisy {
5+
class cat : noisy {
66
priv {
77
let mut meows : uint;
88
fn meow() {

src/test/run-pass/class-implements-multiple-ifaces.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn vec_includes<T>(xs: [T], x: T) -> bool {
2424
}
2525

2626
// vtables other than the 1st one don't seem to work
27-
class cat implements noisy, scratchy, bitey {
27+
class cat : noisy, scratchy, bitey {
2828
priv {
2929
let meows : @mut uint;
3030
let scratched : dvec<furniture>;

0 commit comments

Comments
 (0)