From 6b43c0c1add8d2caaa3c391d8d8daca2c609047e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 13 Aug 2012 17:42:06 -0700 Subject: [PATCH] Stop parsing old operator overloading syntax --- src/libcore/at_vec.rs | 7 ------ src/libcore/core.rs | 4 ++-- src/libcore/dvec.rs | 6 ----- src/libcore/send_map.rs | 3 --- src/libcore/str.rs | 6 ----- src/libcore/vec.rs | 18 --------------- src/libstd/ebml.rs | 10 --------- src/libsyntax/ast.rs | 22 ------------------- src/libsyntax/parse/parser.rs | 17 +------------- src/rustc/middle/ty.rs | 14 ------------ .../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 74f3c59acae2..87802c5c13b2 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -123,13 +123,6 @@ pure fn from_elem(n_elts: uint, t: T) -> @[T] { } } -impl @[T]: vec_concat { - #[inline(always)] - pure fn +(rhs: &[const T]) -> @[T] { - append(self, rhs) - } -} - #[cfg(notest)] impl @[T]: add<&[const T],@[T]> { #[inline(always)] diff --git a/src/libcore/core.rs b/src/libcore/core.rs index dfd53eae20a5..14bafcd68f4a 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 e4ff406a9b70..1f349b670024 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -256,12 +256,6 @@ impl dvec { } } - /// 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 { diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index f49cee1ba078..6ce590c5ec98 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 &linear_map { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 62fb03e92632..8584d4f1524a 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 a90f2fca55fa..fcda831d9051 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1289,17 +1289,6 @@ pure fn as_mut_buf(s: &[mut T], } } -trait vec_concat { - pure fn +(rhs: &[const T]) -> self; -} - -impl ~[T]: vec_concat { - #[inline(always)] - pure fn +(rhs: &[const T]) -> ~[T] { - append(self, rhs) - } -} - #[cfg(notest)] impl ~[T]: add<&[const T],~[T]> { #[inline(always)] @@ -1308,13 +1297,6 @@ impl ~[T]: add<&[const T],~[T]> { } } -impl ~[mut T]: vec_concat { - #[inline(always)] - pure fn +(rhs: &[const T]) -> ~[mut T] { - append_mut(self, rhs) - } -} - impl ~[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 8f0e54a10c50..ca58d6f5f867 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 { pure fn index(&&tag: uint) -> doc { unchecked { diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 8f4eb98fa7b6..57795e5d21c9 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 { 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 { pure fn add(&&id: ident) -> @path { @{ diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 0dd1c70cd936..30f7243d7627 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 8fcd47d3f31d..2d85a0fd296e 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 { 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 fc85484193c8..b77f645d13bc 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 : map { none => { fail ~"epic fail"; } } } - fn [](&&k:int) -> T { self.get(k) } fn find(+k:int) -> option { if k <= self.meows { some(self.name) }