Skip to content

Depure libcore and libstd #5488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 22, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: Remove pure from the test suite
  • Loading branch information
pcwalton committed Mar 22, 2013
commit 3eda11a4f79103a7f6d73c38e5e4f0880e26cc3c
2 changes: 1 addition & 1 deletion src/test/auxiliary/cci_class_cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub mod kitty {
}

impl ToStr for cat {
pure fn to_str(&self) -> ~str { copy self.name }
fn to_str(&self) -> ~str { copy self.name }
}

priv impl cat {
Expand Down
6 changes: 3 additions & 3 deletions src/test/auxiliary/crateresolve5-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ pub enum e {

pub fn nominal() -> e { e_val }

pub pure fn nominal_eq(e1: e, e2: e) -> bool { true }
pub fn nominal_eq(e1: e, e2: e) -> bool { true }

impl Eq for e {
pure fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) }
pure fn ne(&self, other: &e) -> bool { !nominal_eq(*self, *other) }
fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) }
fn ne(&self, other: &e) -> bool { !nominal_eq(*self, *other) }
}

pub fn f() -> int { 10 }
6 changes: 3 additions & 3 deletions src/test/auxiliary/crateresolve5-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ pub enum e {
}

impl Eq for e {
pure fn eq(&self, other: &e) -> bool { !nominal_neq(*self, *other) }
pure fn ne(&self, other: &e) -> bool { nominal_neq(*self, *other) }
fn eq(&self, other: &e) -> bool { !nominal_neq(*self, *other) }
fn ne(&self, other: &e) -> bool { nominal_neq(*self, *other) }
}

pub fn nominal() -> e { e_val }

pub pure fn nominal_neq(e1: e, e2: e) -> bool { false }
pub fn nominal_neq(e1: e, e2: e) -> bool { false }

pub fn f() -> int { 20 }
4 changes: 2 additions & 2 deletions src/test/auxiliary/impl_privacy_xc_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pub struct Fish {
mod unexported {
use super::Fish;
impl Eq for Fish {
pure fn eq(&self, _: &Fish) -> bool { true }
pure fn ne(&self, _: &Fish) -> bool { false }
fn eq(&self, _: &Fish) -> bool { true }
fn ne(&self, _: &Fish) -> bool { false }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/auxiliary/static_fn_trait_xc_aux.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pub mod num {
pub trait Num2 {
pure fn from_int2(n: int) -> Self;
fn from_int2(n: int) -> Self;
}
}

pub mod float {
impl ::num::Num2 for float {
pure fn from_int2(n: int) -> float { return n as float; }
fn from_int2(n: int) -> float { return n as float; }
}
}
12 changes: 6 additions & 6 deletions src/test/auxiliary/trait_inheritance_overloading_xc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ pub struct MyInt {
}

impl Add<MyInt, MyInt> for MyInt {
pure fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
}

impl Sub<MyInt, MyInt> for MyInt {
pure fn sub(&self, other: &MyInt) -> MyInt { mi(self.val - other.val) }
fn sub(&self, other: &MyInt) -> MyInt { mi(self.val - other.val) }
}

impl Mul<MyInt, MyInt> for MyInt {
pure fn mul(&self, other: &MyInt) -> MyInt { mi(self.val * other.val) }
fn mul(&self, other: &MyInt) -> MyInt { mi(self.val * other.val) }
}

impl Eq for MyInt {
pure fn eq(&self, other: &MyInt) -> bool { self.val == other.val }
fn eq(&self, other: &MyInt) -> bool { self.val == other.val }

pure fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
fn ne(&self, other: &MyInt) -> bool { !self.eq(other) }
}

impl MyNum for MyInt;

pure fn mi(v: int) -> MyInt { MyInt { val: v } }
fn mi(v: int) -> MyInt { MyInt { val: v } }

4 changes: 2 additions & 2 deletions src/test/bench/shootout-k-nucleotide-pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
return (xx as float) * 100f / (yy as float);
}

pure fn le_by_val<TT:Copy,UU:Copy + Ord>(kv0: &(TT,UU),
fn le_by_val<TT:Copy,UU:Copy + Ord>(kv0: &(TT,UU),
kv1: &(TT,UU)) -> bool {
let (_, v0) = *kv0;
let (_, v1) = *kv1;
return v0 >= v1;
}

pure fn le_by_key<TT:Copy + Ord,UU:Copy>(kv0: &(TT,UU),
fn le_by_key<TT:Copy + Ord,UU:Copy>(kv0: &(TT,UU),
kv1: &(TT,UU)) -> bool {
let (k0, _) = *kv0;
let (k1, _) = *kv1;
Expand Down
6 changes: 3 additions & 3 deletions src/test/bench/shootout-mandelbrot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct cmplx {
}

impl ops::Mul<cmplx,cmplx> for cmplx {
pure fn mul(&self, x: &cmplx) -> cmplx {
fn mul(&self, x: &cmplx) -> cmplx {
cmplx {
re: self.re*(*x).re - self.im*(*x).im,
im: self.re*(*x).im + self.im*(*x).re
Expand All @@ -42,7 +42,7 @@ impl ops::Mul<cmplx,cmplx> for cmplx {
}

impl ops::Add<cmplx,cmplx> for cmplx {
pure fn add(&self, x: &cmplx) -> cmplx {
fn add(&self, x: &cmplx) -> cmplx {
cmplx {
re: self.re + (*x).re,
im: self.im + (*x).im
Expand All @@ -52,7 +52,7 @@ impl ops::Add<cmplx,cmplx> for cmplx {

struct Line {i: uint, b: ~[u8]}

pure fn cabs(x: cmplx) -> f64
fn cabs(x: cmplx) -> f64
{
x.re*x.re + x.im*x.im
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/auto-ref-slice-plus-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fn main() {
}

trait MyIter {
pure fn test_mut(&mut self);
fn test_mut(&mut self);
}

impl MyIter for &'self [int] {
pure fn test_mut(&mut self) { }
fn test_mut(&mut self) { }
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
struct foo(~uint);

impl Add<foo, foo> for foo {
pure fn add(f: &foo) -> foo {
fn add(f: &foo) -> foo {
foo(~(**self + **(*f)))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Point {
}

impl ops::Add<int,int> for Point {
pure fn add(&self, z: &int) -> int {
fn add(&self, z: &int) -> int {
self.x + self.y + (*z)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/borrowck-loan-rcvr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct point { x: int, y: int }
trait methods {
fn impurem(&self);
fn blockm(&self, f: &fn());
pure fn purem(&self);
fn purem(&self);
}

impl methods for point {
Expand All @@ -22,7 +22,7 @@ impl methods for point {

fn blockm(&self, f: &fn()) { f() }

pure fn purem(&self) {
fn purem(&self) {
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/compile-fail/issue-3344.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

struct thing(uint);
impl cmp::Ord for thing { //~ ERROR missing method `gt`
pure fn lt(&self, other: &thing) -> bool { **self < **other }
pure fn le(&self, other: &thing) -> bool { **self < **other }
pure fn ge(&self, other: &thing) -> bool { **self < **other }
fn lt(&self, other: &thing) -> bool { **self < **other }
fn le(&self, other: &thing) -> bool { **self < **other }
fn ge(&self, other: &thing) -> bool { **self < **other }
}
fn main() {}
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-3707.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ struct Obj {
}

pub impl Obj {
pure fn boom() -> bool {
fn boom() -> bool {
return 1+1 == 2
}
pure fn chirp() {
fn chirp() {
self.boom(); //~ ERROR wat
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-3820.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct Thing {
}

impl Mul<int, Thing>*/ for Thing/* { //~ ERROR Look ma, no Mul!
pure fn mul(c: &int) -> Thing {
fn mul(c: &int) -> Thing {
Thing {x: self.x * *c}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/issue-3953.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct Lol(int);
impl Hahaha for Lol { }

impl Eq for Lol {
pure fn eq(&self, other: &Lol) -> bool { **self != **other }
pure fn ne(&self, other: &Lol) -> bool { **self == **other }
fn eq(&self, other: &Lol) -> bool { **self != **other }
fn ne(&self, other: &Lol) -> bool { **self == **other }
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-3973.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl ToStr for Point { //~ ERROR implements a method not defined in the trait
Point { x: x, y: y }
}

pure fn to_str(&self) -> ~str {
fn to_str(&self) -> ~str {
fmt!("(%f, %f)", self.x, self.y)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/missing-derivable-attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
// except according to those terms.

trait MyEq {
pure fn eq(&self, other: &Self) -> bool;
fn eq(&self, other: &Self) -> bool;
}

struct A {
x: int
}

impl MyEq for int {
pure fn eq(&self, other: &int) -> bool { *self == *other }
fn eq(&self, other: &int) -> bool { *self == *other }
}

impl MyEq for A; //~ ERROR missing method
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/die-macro-pure.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// error-pattern:test

pure fn f() {
fn f() {
fail!(~"test");
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-fail/if-check-fail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// error-pattern:Number is odd
pure fn even(x: uint) -> bool {
fn even(x: uint) -> bool {
if x < 2u {
return false;
} else if x == 2u { return true; } else { return even(x - 2u); }
Expand Down
16 changes: 8 additions & 8 deletions src/test/run-pass/auto-encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum Expr {
}

impl cmp::Eq for Expr {
pure fn eq(&self, other: &Expr) -> bool {
fn eq(&self, other: &Expr) -> bool {
match *self {
Val(e0a) => {
match *other {
Expand All @@ -82,18 +82,18 @@ impl cmp::Eq for Expr {
}
}
}
pure fn ne(&self, other: &Expr) -> bool { !(*self).eq(other) }
fn ne(&self, other: &Expr) -> bool { !(*self).eq(other) }
}

impl cmp::Eq for Point {
pure fn eq(&self, other: &Point) -> bool {
fn eq(&self, other: &Point) -> bool {
self.x == other.x && self.y == other.y
}
pure fn ne(&self, other: &Point) -> bool { !(*self).eq(other) }
fn ne(&self, other: &Point) -> bool { !(*self).eq(other) }
}

impl<T:cmp::Eq> cmp::Eq for Quark<T> {
pure fn eq(&self, other: &Quark<T>) -> bool {
fn eq(&self, other: &Quark<T>) -> bool {
match *self {
Top(ref q) => {
match *other {
Expand All @@ -109,14 +109,14 @@ impl<T:cmp::Eq> cmp::Eq for Quark<T> {
},
}
}
pure fn ne(&self, other: &Quark<T>) -> bool { !(*self).eq(other) }
fn ne(&self, other: &Quark<T>) -> bool { !(*self).eq(other) }
}

impl cmp::Eq for CLike {
pure fn eq(&self, other: &CLike) -> bool {
fn eq(&self, other: &CLike) -> bool {
(*self) as int == *other as int
}
pure fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
}

#[auto_encode]
Expand Down
12 changes: 6 additions & 6 deletions src/test/run-pass/auto-ref-slice-plus-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
// and also references them to create the &self pointer

trait MyIter {
pure fn test_imm(&self);
pure fn test_const(&const self);
fn test_imm(&self);
fn test_const(&const self);
}

impl MyIter for &'self [int] {
pure fn test_imm(&self) { fail_unless!(self[0] == 1) }
pure fn test_const(&const self) { fail_unless!(self[0] == 1) }
fn test_imm(&self) { fail_unless!(self[0] == 1) }
fn test_const(&const self) { fail_unless!(self[0] == 1) }
}

impl MyIter for &'self str {
pure fn test_imm(&self) { fail_unless!(*self == "test") }
pure fn test_const(&const self) { fail_unless!(*self == "test") }
fn test_imm(&self) { fail_unless!(*self == "test") }
fn test_const(&const self) { fail_unless!(*self == "test") }
}

pub fn main() {
Expand Down
Loading