about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-23 18:25:50 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-25 18:24:45 -0700
commitd9bc3cb10c4d1e856998c8e35ce7d89e0d74f4d6 (patch)
tree1c61d6788336a0e076328f76cc33d792dad92f37
parent1cb85015c397cefa9de7653a98b7572ef511e0ef (diff)
downloadrust-d9bc3cb10c4d1e856998c8e35ce7d89e0d74f4d6.tar.gz
rust-d9bc3cb10c4d1e856998c8e35ce7d89e0d74f4d6.zip
Change "pred" to "pure fn" in all libraries and test cases
-rw-r--r--src/lib/char.rs2
-rw-r--r--src/lib/istr.rs4
-rw-r--r--src/lib/uint.rs12
-rw-r--r--src/lib/vec.rs4
-rw-r--r--src/test/compile-fail/constrained-type-missing-check.rs2
-rw-r--r--src/test/compile-fail/do-while-pred-constraints.rs2
-rw-r--r--src/test/compile-fail/if-check-precond-fail.rs2
-rw-r--r--src/test/compile-fail/impure-pred.rs2
-rw-r--r--src/test/compile-fail/not-pred-args.rs2
-rw-r--r--src/test/compile-fail/pred-assign.rs2
-rw-r--r--src/test/compile-fail/pred-on-wrong-slots.rs2
-rw-r--r--src/test/compile-fail/pred-swap.rs2
-rw-r--r--src/test/compile-fail/while-loop-pred-constraints.rs2
-rw-r--r--src/test/run-fail/if-check-fail.rs2
-rw-r--r--src/test/run-fail/pred.rs2
-rw-r--r--src/test/run-pass/claim-nonterm.rs2
-rw-r--r--src/test/run-pass/constrained-type.rs2
-rw-r--r--src/test/run-pass/if-check-precond.rs2
-rw-r--r--src/test/run-pass/if-check.rs2
-rw-r--r--src/test/run-pass/pred-check.rs2
-rw-r--r--src/test/run-pass/pred-not-bool.rs2
-rw-r--r--src/test/run-pass/pred.rs2
-rw-r--r--src/test/run-pass/typestate-transitive.rs2
-rw-r--r--src/test/run-pass/wierd-exprs.rs2
-rw-r--r--src/test/stdtest/vec.rs2
25 files changed, 33 insertions, 31 deletions
diff --git a/src/lib/char.rs b/src/lib/char.rs
index 634c9b9647c..cbd8f667b86 100644
--- a/src/lib/char.rs
+++ b/src/lib/char.rs
@@ -1,4 +1,4 @@
-pred is_whitespace(c: char) -> bool {
+pure fn is_whitespace(c: char) -> bool {
     const ch_space: char = '\u0020';
     const ch_ogham_space_mark: char = '\u1680';
     const ch_mongolian_vowel_sep: char = '\u180e';
diff --git a/src/lib/istr.rs b/src/lib/istr.rs
index b679093cea3..9b3e45e8c53 100644
--- a/src/lib/istr.rs
+++ b/src/lib/istr.rs
@@ -73,12 +73,12 @@ fn is_ascii(s: &istr) -> bool {
 }
 
 /// Returns true if the string has length 0
-pred is_empty(s: &istr) -> bool {
+pure fn is_empty(s: &istr) -> bool {
     for c: u8 in s { ret false; } ret true;
 }
 
 /// Returns true if the string has length greater than 0
-pred is_not_empty(s: &istr) -> bool {
+pure fn is_not_empty(s: &istr) -> bool {
     !is_empty(s)
 }
 
diff --git a/src/lib/uint.rs b/src/lib/uint.rs
index 657138cea9c..3553dc7e2cf 100644
--- a/src/lib/uint.rs
+++ b/src/lib/uint.rs
@@ -10,17 +10,17 @@ fn div(x: uint, y: uint) -> uint { ret x / y; }
 
 fn rem(x: uint, y: uint) -> uint { ret x % y; }
 
-pred lt(x: uint, y: uint) -> bool { ret x < y; }
+pure fn lt(x: uint, y: uint) -> bool { ret x < y; }
 
-pred le(x: uint, y: uint) -> bool { ret x <= y; }
+pure fn le(x: uint, y: uint) -> bool { ret x <= y; }
 
-pred eq(x: uint, y: uint) -> bool { ret x == y; }
+pure fn eq(x: uint, y: uint) -> bool { ret x == y; }
 
-pred ne(x: uint, y: uint) -> bool { ret x != y; }
+pure fn ne(x: uint, y: uint) -> bool { ret x != y; }
 
-pred ge(x: uint, y: uint) -> bool { ret x >= y; }
+pure fn ge(x: uint, y: uint) -> bool { ret x >= y; }
 
-pred gt(x: uint, y: uint) -> bool { ret x > y; }
+pure fn gt(x: uint, y: uint) -> bool { ret x > y; }
 
 fn max(x: uint, y: uint) -> uint { if x > y { ret x; } ret y; }
 
diff --git a/src/lib/vec.rs b/src/lib/vec.rs
index dde4fc7505b..f387ec75b51 100644
--- a/src/lib/vec.rs
+++ b/src/lib/vec.rs
@@ -77,13 +77,13 @@ fn from_mut<@T>(v: &[mutable T]) -> [T] {
 }
 
 // Predicates
-pred is_empty<T>(v: &[mutable? T]) -> bool {
+pure fn is_empty<T>(v: &[mutable? T]) -> bool {
     // FIXME: This would be easier if we could just call len
     for t: T in v { ret false; }
     ret true;
 }
 
-pred is_not_empty<T>(v: &[mutable? T]) -> bool { ret !is_empty(v); }
+pure fn is_not_empty<T>(v: &[mutable? T]) -> bool { ret !is_empty(v); }
 
 // Accessors
 
diff --git a/src/test/compile-fail/constrained-type-missing-check.rs b/src/test/compile-fail/constrained-type-missing-check.rs
index 4ad2380a788..78c8f64ee9c 100644
--- a/src/test/compile-fail/constrained-type-missing-check.rs
+++ b/src/test/compile-fail/constrained-type-missing-check.rs
@@ -8,7 +8,7 @@ tag list { cons(int, @list); nil; }
 
 type bubu = {x: int, y: int};
 
-pred less_than(x: int, y: int) -> bool { ret x < y; }
+pure fn less_than(x: int, y: int) -> bool { ret x < y; }
 
 type ordered_range = {low: int, high: int} : less_than(low, high);
 
diff --git a/src/test/compile-fail/do-while-pred-constraints.rs b/src/test/compile-fail/do-while-pred-constraints.rs
index 90fcd26ea9f..49e7ec220bb 100644
--- a/src/test/compile-fail/do-while-pred-constraints.rs
+++ b/src/test/compile-fail/do-while-pred-constraints.rs
@@ -2,7 +2,7 @@
 
 fn print_even(y: int) : even(y) { log y; }
 
-pred even(y: int) -> bool { true }
+pure fn even(y: int) -> bool { true }
 
 fn main() {
     let y: int = 42;
diff --git a/src/test/compile-fail/if-check-precond-fail.rs b/src/test/compile-fail/if-check-precond-fail.rs
index 9ce0d6f8ef5..aed84faacc3 100644
--- a/src/test/compile-fail/if-check-precond-fail.rs
+++ b/src/test/compile-fail/if-check-precond-fail.rs
@@ -1,5 +1,5 @@
 // error-pattern:Unsatisfied precondition constraint
-pred even(x: uint) -> bool {
+pure fn even(x: uint) -> bool {
     if x < 2u {
         ret false;
     } else if x == 2u { ret true; } else { ret even(x - 2u); }
diff --git a/src/test/compile-fail/impure-pred.rs b/src/test/compile-fail/impure-pred.rs
index 05433ba17ed..42715eaa36e 100644
--- a/src/test/compile-fail/impure-pred.rs
+++ b/src/test/compile-fail/impure-pred.rs
@@ -3,7 +3,7 @@
 
 fn g() { }
 
-pred f(q: int) -> bool { g(); ret true; }
+pure fn f(q: int) -> bool { g(); ret true; }
 
 fn main() {
     let x = 0;
diff --git a/src/test/compile-fail/not-pred-args.rs b/src/test/compile-fail/not-pred-args.rs
index 6ba399ba00c..7a90f1cfa99 100644
--- a/src/test/compile-fail/not-pred-args.rs
+++ b/src/test/compile-fail/not-pred-args.rs
@@ -2,7 +2,7 @@
 
 // error-pattern: Constraint args must be
 
-pred f(q: int) -> bool { ret true; }
+pure fn f(q: int) -> bool { ret true; }
 
 fn main() {
     // should fail to typecheck, as pred args must be slot variables
diff --git a/src/test/compile-fail/pred-assign.rs b/src/test/compile-fail/pred-assign.rs
index 10c6f1443ec..f8975bb1889 100644
--- a/src/test/compile-fail/pred-assign.rs
+++ b/src/test/compile-fail/pred-assign.rs
@@ -4,7 +4,7 @@
 
 fn f(a: int, b: int) : lt(a, b) { }
 
-pred lt(a: int, b: int) -> bool { ret a < b; }
+pure fn lt(a: int, b: int) -> bool { ret a < b; }
 
 fn main() {
     let a: int = 10;
diff --git a/src/test/compile-fail/pred-on-wrong-slots.rs b/src/test/compile-fail/pred-on-wrong-slots.rs
index 9e6c86c0737..3d887e8d6ef 100644
--- a/src/test/compile-fail/pred-on-wrong-slots.rs
+++ b/src/test/compile-fail/pred-on-wrong-slots.rs
@@ -4,7 +4,7 @@
 
 fn f(a: int, b: int) : lt(a, b) { }
 
-pred lt(a: int, b: int) -> bool { ret a < b; }
+pure fn lt(a: int, b: int) -> bool { ret a < b; }
 
 fn main() {
     let a: int = 10;
diff --git a/src/test/compile-fail/pred-swap.rs b/src/test/compile-fail/pred-swap.rs
index 8fe7b19acf5..26cca68c5e4 100644
--- a/src/test/compile-fail/pred-swap.rs
+++ b/src/test/compile-fail/pred-swap.rs
@@ -4,7 +4,7 @@
 
 fn f(a: int, b: int) : lt(a, b) { }
 
-pred lt(a: int, b: int) -> bool { ret a < b; }
+pure fn lt(a: int, b: int) -> bool { ret a < b; }
 
 fn main() {
     let a: int = 10;
diff --git a/src/test/compile-fail/while-loop-pred-constraints.rs b/src/test/compile-fail/while-loop-pred-constraints.rs
index 5920d25230f..bf761b31199 100644
--- a/src/test/compile-fail/while-loop-pred-constraints.rs
+++ b/src/test/compile-fail/while-loop-pred-constraints.rs
@@ -2,7 +2,7 @@
 
 fn print_even(y: int) : even(y) { log y; }
 
-pred even(y: int) -> bool { true }
+pure fn even(y: int) -> bool { true }
 
 fn main() {
 
diff --git a/src/test/run-fail/if-check-fail.rs b/src/test/run-fail/if-check-fail.rs
index 885c92deab8..2af0b111f8e 100644
--- a/src/test/run-fail/if-check-fail.rs
+++ b/src/test/run-fail/if-check-fail.rs
@@ -1,5 +1,5 @@
 // error-pattern:Number is odd
-pred even(x: uint) -> bool {
+pure fn even(x: uint) -> bool {
     if x < 2u {
         ret false;
     } else if x == 2u { ret true; } else { ret even(x - 2u); }
diff --git a/src/test/run-fail/pred.rs b/src/test/run-fail/pred.rs
index a2f9420825c..494bee968f1 100644
--- a/src/test/run-fail/pred.rs
+++ b/src/test/run-fail/pred.rs
@@ -2,6 +2,6 @@
 // error-pattern:Predicate lt(b, a) failed
 fn f(a: int, b: int) { }
 
-pred lt(a: int, b: int) -> bool { ret a < b; }
+pure fn lt(a: int, b: int) -> bool { ret a < b; }
 
 fn main() { let a: int = 10; let b: int = 23; check (lt(b, a)); f(b, a); }
diff --git a/src/test/run-pass/claim-nonterm.rs b/src/test/run-pass/claim-nonterm.rs
index 770beeb9fbf..13741ef3961 100644
--- a/src/test/run-pass/claim-nonterm.rs
+++ b/src/test/run-pass/claim-nonterm.rs
@@ -3,6 +3,6 @@ use std;
 import std::str::*;
 import std::uint::*;
 
-pred fails(a: uint) -> bool { fail; }
+pure fn fails(a: uint) -> bool { fail; }
 
 fn main() { let b: uint = 4u; claim (fails(b)); }
diff --git a/src/test/run-pass/constrained-type.rs b/src/test/run-pass/constrained-type.rs
index d05e4311dbf..fdf48e2fb04 100644
--- a/src/test/run-pass/constrained-type.rs
+++ b/src/test/run-pass/constrained-type.rs
@@ -4,7 +4,7 @@ tag list { cons(int, @list); nil; }
 
 type bubu = {x: int, y: int};
 
-pred less_than(x: int, y: int) -> bool { ret x < y; }
+pure fn less_than(x: int, y: int) -> bool { ret x < y; }
 
 type ordered_range = {low: int, high: int}  : less_than(*.low, *.high);
 
diff --git a/src/test/run-pass/if-check-precond.rs b/src/test/run-pass/if-check-precond.rs
index eadffd7b75a..5f3715273ae 100644
--- a/src/test/run-pass/if-check-precond.rs
+++ b/src/test/run-pass/if-check-precond.rs
@@ -1,4 +1,4 @@
-pred even(x: uint) -> bool {
+pure fn even(x: uint) -> bool {
     if x < 2u {
         ret false;
     } else if x == 2u { ret true; } else { ret even(x - 2u); }
diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs
index 090330bef0e..508bc8385cf 100644
--- a/src/test/run-pass/if-check.rs
+++ b/src/test/run-pass/if-check.rs
@@ -1,4 +1,4 @@
-pred even(x: uint) -> bool {
+pure fn even(x: uint) -> bool {
     if x < 2u {
         ret false;
     } else if x == 2u { ret true; } else { ret even(x - 2u); }
diff --git a/src/test/run-pass/pred-check.rs b/src/test/run-pass/pred-check.rs
index 12b1ff5ed73..588288cea2f 100644
--- a/src/test/run-pass/pred-check.rs
+++ b/src/test/run-pass/pred-check.rs
@@ -1,4 +1,4 @@
 // -*- rust -*-
-pred f(q: int) -> bool { ret true; }
+pure fn f(q: int) -> bool { ret true; }
 
 fn main() { let x = 0; check (f(x)); }
diff --git a/src/test/run-pass/pred-not-bool.rs b/src/test/run-pass/pred-not-bool.rs
index 1f70cb73f60..6d1ad3a72ad 100644
--- a/src/test/run-pass/pred-not-bool.rs
+++ b/src/test/run-pass/pred-not-bool.rs
@@ -1,3 +1,5 @@
+// FIXME should be in run-pass
+
 // -*- rust -*-
 
 // error-pattern: Non-boolean return type
diff --git a/src/test/run-pass/pred.rs b/src/test/run-pass/pred.rs
index 5c9a56c904c..212e77cbdc1 100644
--- a/src/test/run-pass/pred.rs
+++ b/src/test/run-pass/pred.rs
@@ -1,7 +1,7 @@
 // -*- rust -*-
 fn f(a: int, b: int) { }
 
-pred lt(a: int, b: int) -> bool { ret a < b; }
+pure fn lt(a: int, b: int) -> bool { ret a < b; }
 
 fn main() {
     let a: int = 10;
diff --git a/src/test/run-pass/typestate-transitive.rs b/src/test/run-pass/typestate-transitive.rs
index 021dd7554b7..632aec5c4d1 100644
--- a/src/test/run-pass/typestate-transitive.rs
+++ b/src/test/run-pass/typestate-transitive.rs
@@ -1,4 +1,4 @@
-pred p(i: int) -> bool { true }
+pure fn p(i: int) -> bool { true }
 
 fn f(i: int) : p(i) -> int { i }
 
diff --git a/src/test/run-pass/wierd-exprs.rs b/src/test/run-pass/wierd-exprs.rs
index de1613c4363..68add65630f 100644
--- a/src/test/run-pass/wierd-exprs.rs
+++ b/src/test/run-pass/wierd-exprs.rs
@@ -40,7 +40,7 @@ fn hammertime() -> int {
 }
 
 fn canttouchthis() -> uint {
-    pred p() -> bool { true }
+    pure fn p() -> bool { true }
     let _a = (assert (true)) == (check (p()));
     let _c = (check (p())) == ();
     let _b = (log 0) == (ret 0u);
diff --git a/src/test/stdtest/vec.rs b/src/test/stdtest/vec.rs
index a57056c552d..f5c4af42681 100644
--- a/src/test/stdtest/vec.rs
+++ b/src/test/stdtest/vec.rs
@@ -10,7 +10,7 @@ fn square(n: uint) -> uint { ret n * n; }
 
 fn square_alias(n: &uint) -> uint { ret n * n; }
 
-pred is_three(n: &uint) -> bool { ret n == 3u; }
+pure fn is_three(n: &uint) -> bool { ret n == 3u; }
 
 fn square_if_odd(n: &uint) -> option::t<uint> {
     ret if n % 2u == 1u { some(n * n) } else { none };