diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-13 17:42:06 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-13 18:59:17 -0700 |
| commit | 6b43c0c1add8d2caaa3c391d8d8daca2c609047e (patch) | |
| tree | 2223eb0347d5dd4084afaed19120874fd2a03c7b | |
| parent | 2e1b98d34f105f4632b30bcd5c51e40cb7a1b637 (diff) | |
| download | rust-6b43c0c1add8d2caaa3c391d8d8daca2c609047e.tar.gz rust-6b43c0c1add8d2caaa3c391d8d8daca2c609047e.zip | |
Stop parsing old operator overloading syntax
| -rw-r--r-- | src/libcore/at_vec.rs | 7 | ||||
| -rw-r--r-- | src/libcore/core.rs | 4 | ||||
| -rw-r--r-- | src/libcore/dvec.rs | 6 | ||||
| -rw-r--r-- | src/libcore/send_map.rs | 3 | ||||
| -rw-r--r-- | src/libcore/str.rs | 6 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 18 | ||||
| -rw-r--r-- | src/libstd/ebml.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 22 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 17 | ||||
| -rw-r--r-- | src/rustc/middle/ty.rs | 14 | ||||
| -rw-r--r-- | src/test/run-pass/class-impl-very-parameterized-trait.rs | 1 |
11 files changed, 3 insertions, 105 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 74f3c59acae..87802c5c13b 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -123,13 +123,6 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> @[T] { } } -impl<T: copy> @[T]: vec_concat<T> { - #[inline(always)] - pure fn +(rhs: &[const T]) -> @[T] { - append(self, rhs) - } -} - #[cfg(notest)] impl<T: copy> @[T]: add<&[const T],@[T]> { #[inline(always)] diff --git a/src/libcore/core.rs b/src/libcore/core.rs index dfd53eae20a..14bafcd68f4 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -8,7 +8,7 @@ import path = path::path; import tuple::{tuple_ops, extended_tuple_ops}; import str::{str_slice, unique_str}; import vec::{const_vector, copyable_vector, immutable_vector}; -import vec::{immutable_copyable_vector, iter_trait_extensions, vec_concat}; +import vec::{immutable_copyable_vector, iter_trait_extensions}; import iter::{base_iter, extended_iter, copyable_iter, times, timesi}; import num::num; import ptr::ptr; @@ -21,7 +21,7 @@ export num, times, timesi; // The following exports are the common traits export str_slice, unique_str; export const_vector, copyable_vector, immutable_vector; -export immutable_copyable_vector, iter_trait_extensions, vec_concat; +export immutable_copyable_vector, iter_trait_extensions; export base_iter, copyable_iter, extended_iter; export tuple_ops, extended_tuple_ops; export ptr; diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index e4ff406a9b7..1f349b67002 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -258,12 +258,6 @@ impl<A: copy> dvec<A> { /// Copy out an individual element #[inline(always)] - pure fn [](idx: uint) -> A { - self.get_elt(idx) - } - - /// Copy out an individual element - #[inline(always)] pure fn get_elt(idx: uint) -> A { self.check_not_borrowed(); return self.data[idx]; diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index f49cee1ba07..6ce590c5ec9 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -275,9 +275,6 @@ mod linear { option::unwrap(value) } - fn [](k: &K) -> V { - self.get(k) - } } impl<K,V> &linear_map<K,V> { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 62fb03e9263..8584d4f1524 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1911,12 +1911,6 @@ impl ~str: unique_str { /// Returns a string with trailing whitespace removed #[inline] fn trim_right() -> ~str { trim_right(self) } - - /// Concatenate two strings: operator version - #[inline(always)] - pure fn +(rhs: &str) -> ~str { - append(self, rhs) - } } #[cfg(notest)] diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index a90f2fca55f..fcda831d905 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1289,17 +1289,6 @@ pure fn as_mut_buf<T,U>(s: &[mut T], } } -trait vec_concat<T> { - pure fn +(rhs: &[const T]) -> self; -} - -impl<T: copy> ~[T]: vec_concat<T> { - #[inline(always)] - pure fn +(rhs: &[const T]) -> ~[T] { - append(self, rhs) - } -} - #[cfg(notest)] impl<T: copy> ~[T]: add<&[const T],~[T]> { #[inline(always)] @@ -1308,13 +1297,6 @@ impl<T: copy> ~[T]: add<&[const T],~[T]> { } } -impl<T: copy> ~[mut T]: vec_concat<T> { - #[inline(always)] - pure fn +(rhs: &[const T]) -> ~[mut T] { - append_mut(self, rhs) - } -} - impl<T: copy> ~[mut T]: add<&[const T],~[mut T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> ~[mut T] { diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 8f0e54a10c5..ca58d6f5f86 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -42,16 +42,6 @@ type doc = {data: @~[u8], start: uint, end: uint}; type tagged_doc = {tag: uint, doc: doc}; -trait get_doc { - fn [](tag: uint) -> doc; -} - -impl doc: get_doc { - fn [](tag: uint) -> doc { - get_doc(self, tag) - } -} - impl doc: ops::index<uint,doc> { pure fn index(&&tag: uint) -> doc { unchecked { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 8f4eb98fa7b..57795e5d21c 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -821,34 +821,12 @@ pure fn empty_span() -> span { // Convenience implementations -// Remove after snapshot! -trait path_concat { - pure fn +(&&id: ident) -> @path; -} - -// Remove after snapshot! -impl ident: path_concat { - pure fn +(&&id: ident) -> @path { - simple_path(self, empty_span()) + id - } -} - impl ident: ops::add<ident,@path> { pure fn add(&&id: ident) -> @path { simple_path(self, empty_span()) + id } } -// Remove after snapshot! -impl @path: path_concat { - pure fn +(&&id: ident) -> @path { - @{ - idents: vec::append_one(self.idents, id) - with *self - } - } -} - impl @path: ops::add<ident,@path> { pure fn add(&&id: ident) -> @path { @{ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0dd1c70cd93..30f7243d762 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2391,22 +2391,7 @@ class parser { } fn parse_method_name() -> ident { - match copy self.token { - token::BINOP(op) => { self.bump(); @token::binop_to_str(op) } - token::NOT => { self.bump(); @~"!" } - token::LBRACKET => { - self.bump(); - self.expect(token::RBRACKET); - @~"[]" - } - _ => { - let id = self.parse_value_ident(); - if id == @~"unary" && self.eat(token::BINOP(token::MINUS)) { - @~"unary-" - } - else { id } - } - } + self.parse_value_ident() } fn parse_method(pr: visibility) -> @method { diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 8fcd47d3f31..2d85a0fd296 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1522,20 +1522,6 @@ fn remove_copyable(k: kind) -> kind { k - kind_(KIND_MASK_COPY) } -impl kind { - fn &(other: kind) -> kind { - lower_kind(self, other) - } - - fn |(other: kind) -> kind { - raise_kind(self, other) - } - - fn -(other: kind) -> kind { - kind_(*self & !*other) - } -} - impl kind: ops::bitand<kind,kind> { pure fn bitand(other: kind) -> kind { unchecked { diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index fc85484193c..b77f645d13b 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -53,7 +53,6 @@ class cat<T: copy> : map<int, T> { none => { fail ~"epic fail"; } } } - fn [](&&k:int) -> T { self.get(k) } fn find(+k:int) -> option<T> { if k <= self.meows { some(self.name) } |
