]> git.lizzy.rs Git - rust.git/commitdiff
Remove 'implements' keyword in favour of :, part of #2301.
authorGraydon Hoare <graydon@mozilla.com>
Sat, 23 Jun 2012 01:19:35 +0000 (18:19 -0700)
committerGraydon Hoare <graydon@mozilla.com>
Sat, 23 Jun 2012 01:57:20 +0000 (18:57 -0700)
17 files changed:
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/test/auxiliary/cci_class_cast.rs
src/test/compile-fail/class-cast-to-iface.rs
src/test/compile-fail/class-implements-bad-iface.rs
src/test/compile-fail/class-implements-int.rs
src/test/compile-fail/class-method-missing.rs
src/test/run-pass/class-cast-to-iface-cross-crate.rs
src/test/run-pass/class-cast-to-iface-multiple-types.rs
src/test/run-pass/class-cast-to-iface.rs
src/test/run-pass/class-iface-bounded-param.rs
src/test/run-pass/class-impl-parameterized-iface.rs
src/test/run-pass/class-impl-very-parameterized-iface.rs
src/test/run-pass/class-implement-iface-cross-crate.rs
src/test/run-pass/class-implement-ifaces.rs
src/test/run-pass/class-implements-multiple-ifaces.rs

index 46e838fd4bef0f6f34edb8d23a74cacb956305ce..28fee93fad752c51569e03ead23a2d52e8237756 100644 (file)
@@ -1979,7 +1979,7 @@ fn parse_item_class() -> item_info {
         let rp = self.parse_region_param();
         let ty_params = self.parse_ty_params();
         let class_path = self.ident_to_path_tys(class_name, rp, ty_params);
-        let ifaces : [@iface_ref] = if self.eat_keyword("implements")
+        let ifaces : [@iface_ref] = if self.eat(token::COLON)
             { self.parse_iface_ref_list() }
         else { [] };
         self.expect(token::LBRACE);
index 39327f1efadbc5fa45201c4f29a2384a1cbe83f1..0a166dceb1d21f8ab5a9ca8984b7852b8a43d139 100644 (file)
@@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> {
     let keys = [
         "as",
         "else",
-        "implements",
         "move",
         "of",
         "priv", "pub",
index 89f3b2d3aba960579d48070dafa597dd77a1a9ee..f632f3bcc210f7605187858c6eaf8a906d1ec923 100644 (file)
@@ -527,9 +527,11 @@ fn print_item(s: ps, &&item: @ast::item) {
           word_nbsp(s, *item.ident);
           print_region_param(s, rp);
           print_type_params(s, tps);
-          word_space(s, "implements");
-          commasep(s, inconsistent, ifaces, {|s, p|
-                      print_path(s, p.path, false)});
+          if vec::len(ifaces) != 0u {
+              word_space(s, ":");
+              commasep(s, inconsistent, ifaces, {|s, p|
+                  print_path(s, p.path, false)});
+          }
           bopen(s);
           hardbreak_if_not_bol(s);
           maybe_print_comment(s, ctor.span.lo);
index 997cab281553fbcce3eaa4dd61957389d73a2a7b..63b8426ac93c19e81fd0be7f30b7f307d746df8b 100644 (file)
@@ -3,7 +3,7 @@
 
 mod kitty {
 
-class cat implements to_str {
+class cat : to_str {
   priv {
     let mut meows : uint;
     fn meow() {
index 2088d716ed729210e0d13370b0fc31ab26cb8151..e79c021d9f3ef79f39ac163871eda6390f652ec6 100644 (file)
@@ -3,7 +3,7 @@
   fn speak();
 }
 
-class cat implements noisy {
+class cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index ff7d9fbe32788d5843f5a447281606e0f39a0901..4e95b986a9ab8421cd8499bbf6c67832d2998233 100644 (file)
@@ -1,5 +1,5 @@
 // error-pattern:unresolved typename: nonexistent
-class cat implements nonexistent {
+class cat : nonexistent {
   let meows: uint;
   new(in_x : uint) { self.meows = in_x; }
 }
index 7a2a7ad4f949254a87a3492e64a4f7f3a2d4110a..1768b8c4bf04729c46a20bc3adbb7a595b09b5d4 100644 (file)
@@ -1,4 +1,4 @@
-class cat implements int { //! ERROR can only implement interface types
+class cat : int { //! ERROR can only implement interface types
   let meows: uint;
   new(in_x : uint) { self.meows = in_x; }
 }
index 6e6092fceab2bd7e0654a1e8587453f075db905e..788baa73c345cc78e6ef3606d547b94493304776 100644 (file)
@@ -3,7 +3,7 @@
   fn eat();
 }
 
-class cat implements animal {
+class cat : animal {
   let meows: uint;
   new(in_x : uint) { self.meows = in_x; }
 }
index 14722b71794956c4c01fbd5f58c2143ac9c5d2f6..13c0e60c427f488dbc9c8da79b91785bd679dc5e 100644 (file)
@@ -1,7 +1,7 @@
 import to_str::*;
 import to_str::to_str;
 
-class cat implements to_str {
+class cat : to_str {
   priv {
     let mut meows : uint;
     fn meow() {
index 84bc53ac807fea2f8b7855bc153cf8f35cfcb695..e2dc7b732a8ef027751bfca7f34b94cd9831734b 100644 (file)
@@ -2,7 +2,7 @@
   fn speak() -> int;
 }
 
-class dog implements noisy {
+class dog : noisy {
   priv {
     let barks : @mut uint;
     fn bark() -> int {
@@ -26,7 +26,7 @@ fn bark() -> int {
   fn speak() -> int { self.bark() }
 }
 
-class cat implements noisy {
+class cat : noisy {
   priv {
     let meows : @mut uint;
     fn meow() -> uint {
index 90b3d67cb59ec77bdcb01176ad4b4780223848b8..10222acc45aa71c87cf625de59041e6f8fb7d67b 100644 (file)
@@ -2,7 +2,7 @@
   fn speak();
 }
 
-class cat implements noisy {
+class cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index fd0ea20b5fbf0e606285f7c1e445b142379fd2b0..4da75037421c0502ea2ee68e0ce6de0cf533a431 100644 (file)
@@ -2,7 +2,7 @@
 import std::map::{map, hashmap, int_hash};
 
 class keys<K: copy, V: copy, M: copy map<K,V>>
-    implements iter::base_iter<K> {
+    : iter::base_iter<K> {
 
     let map: M;
 
index b7533bfe4267707e366415ffc32796ed5193f591..dc76b57c2d26484e835b222059d40e321e38a67a 100644 (file)
@@ -2,7 +2,7 @@
 use std;
 import std::map::*;
 
-class cat implements map<int, bool> {
+class cat : map<int, bool> {
   priv {
     // Yes, you can have negative meows
     let mut meows : int;
index 89674fecfa49535f6c66499de5d3422431dd4b81..30c4be25c604351d2f8cb5ff0fe7c4f796940ae0 100644 (file)
@@ -7,7 +7,7 @@ enum cat_type { tuxedo, tabby, tortoiseshell }
 // for any int value that's less than the meows field
 
 // ok: T should be in scope when resolving the iface ref for map
-class cat<T: copy> implements map<int, T> {
+class cat<T: copy> : map<int, T> {
   priv {
     // Yes, you can have negative meows
     let mut meows : int;
index 62f8cdb39f8da1166f1acaecf32b8e8120255e2e..5add42fb263c89614d7229544bce0447845a423d 100644 (file)
@@ -3,7 +3,7 @@
 use cci_class_iface;
 import cci_class_iface::animals::*;
 
-class cat implements noisy {
+class cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index 0dcf3c8104abb219b6a50080745b5b67efb456c8..f772ef957d7eee842a4eced98beda64c08cf68b1 100644 (file)
@@ -2,7 +2,7 @@
   fn speak();
 }
 
-class cat implements noisy {
+class cat : noisy {
   priv {
     let mut meows : uint;
     fn meow() {
index 1a8f777767205d84d9b5f16f6de9637788ce0544..fe3f160c1f8184f52ede87251ef9b36fa9ea66d4 100644 (file)
@@ -24,7 +24,7 @@ fn vec_includes<T>(xs: [T], x: T) -> bool {
 }
 
 // vtables other than the 1st one don't seem to work
-class cat implements noisy, scratchy, bitey {
+class cat : noisy, scratchy, bitey {
   priv {
     let meows : @mut uint;
     let scratched : dvec<furniture>;