about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-03-07 15:44:21 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-03-11 09:35:58 -0700
commitbd2d17e4a1f75bc7e451fc1054d98ff13c456850 (patch)
tree4786d560c72b34b8725be337a677c4c6b8a47508
parentd18f7854578e8c2e1d7dce90db6e3b5cf9befba9 (diff)
downloadrust-bd2d17e4a1f75bc7e451fc1054d98ff13c456850.tar.gz
rust-bd2d17e4a1f75bc7e451fc1054d98ff13c456850.zip
libsyntax: Stop parsing bare functions in preparation for switching them over
-rw-r--r--src/libcore/hashmap.rs4
-rw-r--r--src/libcore/num/uint-template.rs5
-rw-r--r--src/libcore/str.rs12
-rw-r--r--src/libcore/trie.rs5
-rw-r--r--src/libstd/rl.rs2
-rw-r--r--src/libstd/treemap.rs4
-rw-r--r--src/libsyntax/parse/obsolete.rs5
-rw-r--r--src/libsyntax/parse/parser.rs12
8 files changed, 40 insertions, 9 deletions
diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs
index 6f63cdbabb5..2adcee495a7 100644
--- a/src/libcore/hashmap.rs
+++ b/src/libcore/hashmap.rs
@@ -599,7 +599,9 @@ pub mod linear {
         }
 
         /// Visit the values representing the intersection
-        pure fn intersection(&self, other: &LinearSet<T>, f: &fn(&T) -> bool) {
+        pure fn intersection(&self,
+                             other: &LinearSet<T>,
+                             f: &fn(&T) -> bool) {
             for self.each |v| {
                 if other.contains(v) {
                     if !f(v) { return }
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 9a141bfd341..9abbfb03d7a 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -67,7 +67,10 @@ pub pure fn is_nonnegative(x: T) -> bool { x >= 0 as T }
  * Iterate over the range [`start`,`start`+`step`..`stop`)
  *
  */
-pub pure fn range_step(start: T, stop: T, step: T_SIGNED, it: &fn(T) -> bool) {
+pub pure fn range_step(start: T,
+                       stop: T,
+                       step: T_SIGNED,
+                       it: &fn(T) -> bool) {
     let mut i = start;
     if step == 0 {
         fail!(~"range_step called with step == 0");
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 415c12e33a8..ae778cb7649 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -491,7 +491,10 @@ pub pure fn split(s: &str, sepfn: &fn(char) -> bool) -> ~[~str] {
  * Splits a string into substrings using a character function, cutting at
  * most `count` times.
  */
-pub pure fn splitn(s: &str, sepfn: &fn(char) -> bool, count: uint) -> ~[~str] {
+pub pure fn splitn(s: &str,
+                   sepfn: &fn(char) -> bool,
+                   count: uint)
+                -> ~[~str] {
     split_inner(s, sepfn, count, true)
 }
 
@@ -1246,8 +1249,11 @@ pub pure fn find_from(s: &str, start: uint, f: &fn(char)
  * or equal to `len(s)`. `start` must be the index of a character
  * boundary, as defined by `is_char_boundary`.
  */
-pub pure fn find_between(s: &str, start: uint, end: uint, f: &fn(char) -> bool)
-    -> Option<uint> {
+pub pure fn find_between(s: &str,
+                         start: uint,
+                         end: uint,
+                         f: &fn(char) -> bool)
+                      -> Option<uint> {
     fail_unless!(start <= end);
     fail_unless!(end <= len(s));
     fail_unless!(is_char_boundary(s, start));
diff --git a/src/libcore/trie.rs b/src/libcore/trie.rs
index 4bd751adc3c..7dc85cba297 100644
--- a/src/libcore/trie.rs
+++ b/src/libcore/trie.rs
@@ -81,7 +81,10 @@ impl<T> Map<uint, T> for TrieMap<T> {
 
     /// Visit all values in order
     #[inline(always)]
-    pure fn each_value(&self, f: &fn(&T) -> bool) { self.each(|&(_, v)| f(v)) }
+    pure fn each_value(&self,
+                       f: &fn(&T) -> bool) {
+        self.each(|&(_, v)| f(v))
+    }
 
     /// Return the value corresponding to the key in the map
     #[inline(hint)]
diff --git a/src/libstd/rl.rs b/src/libstd/rl.rs
index b2b30c1057e..a8b25767ce5 100644
--- a/src/libstd/rl.rs
+++ b/src/libstd/rl.rs
@@ -68,7 +68,7 @@ pub unsafe fn read(prompt: ~str) -> Option<~str> {
     }
 }
 
-pub type CompletionCb = @fn(~str, fn(~str));
+pub type CompletionCb<'self> = @fn(~str, &'self fn(~str));
 
 fn complete_key(_v: @CompletionCb) {}
 
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index f053bcfd397..72351aac339 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -138,7 +138,9 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
     pure fn each_key(&self, f: &fn(&K) -> bool) { self.each(|&(k, _)| f(k)) }
 
     /// Visit all values in order
-    pure fn each_value(&self, f: &fn(&V) -> bool) { self.each(|&(_, v)| f(v)) }
+    pure fn each_value(&self, f: &fn(&V) -> bool) {
+        self.each(|&(_, v)| f(v))
+    }
 
     /// Return the value corresponding to the key in the map
     pure fn find(&self, key: &K) -> Option<&self/V> {
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 97ff175da07..757df713fc0 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -53,6 +53,7 @@ pub enum ObsoleteSyntax {
     ObsoleteRecordPattern,
     ObsoleteAssertion,
     ObsoletePostFnTySigil,
+    ObsoleteBareFnType,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -166,6 +167,10 @@ pub impl Parser {
                 "Rather than `fn@`, `fn~`, or `fn&`, \
                  write `@fn`, `~fn`, and `&fn` respectively"
             ),
+            ObsoleteBareFnType => (
+                "bare function type",
+                "use `&fn` or `extern fn` instead"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 92ff83a3975..1c3d906e164 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -76,7 +76,11 @@ use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
 use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
 use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
 use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
+<<<<<<< HEAD
 use parse::obsolete::{ObsoleteAssertion, ObsoletePostFnTySigil};
+=======
+use parse::obsolete::{ObsoleteAssertion, ObsoleteBareFnType};
+>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over
 use parse::prec::{as_prec, token_to_binop};
 use parse::token::{can_begin_expr, is_ident, is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, special_idents};
@@ -647,8 +651,14 @@ pub impl Parser {
         } else if self.eat_keyword(&~"extern") {
             self.parse_ty_bare_fn()
         } else if self.token_is_closure_keyword(&copy *self.token) {
+<<<<<<< HEAD
             // self.warn(fmt!("Old-school closure keyword"));
             self.parse_ty_closure(ast::BorrowedSigil, None)
+=======
+            let result = self.parse_ty_closure(None, None);
+            self.obsolete(*self.last_span, ObsoleteBareFnType);
+            result
+>>>>>>> libsyntax: Stop parsing bare functions in preparation for switching them over
         } else if *self.token == token::MOD_SEP
             || is_ident_or_path(&*self.token) {
             let path = self.parse_path_with_tps(colons_before_params);
@@ -2813,7 +2823,7 @@ pub impl Parser {
     fn parse_fn_decl_with_self(
         &self,
         parse_arg_fn:
-        fn(&Parser) -> arg_or_capture_item
+        &fn(&Parser) -> arg_or_capture_item
     ) -> (self_ty, fn_decl) {
         fn maybe_parse_self_ty(
             cnstr: &fn(+v: mutability) -> ast::self_ty_,