Skip to content

Commit db518ef

Browse files
committed
test: Fix tests.
1 parent 08e561a commit db518ef

20 files changed

+55
-42
lines changed

src/test/auxiliary/extern-crosscrate-source.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
pub mod rustrt {
1717
pub extern {
18-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
19-
-> libc::uintptr_t;
18+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
19+
-> libc::uintptr_t,
20+
data: libc::uintptr_t)
21+
-> libc::uintptr_t;
2022
}
2123
}
2224

src/test/run-pass/const-cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
extern fn foo() {}
1212

13-
static x: *u8 = foo;
13+
static x: extern "C" fn() = foo;
1414
static y: *libc::c_void = x as *libc::c_void;
1515
static a: &'static int = &10;
1616
static b: *int = a as *int;

src/test/run-pass/const-cross-crate-extern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
extern mod cci_const;
1515
use cci_const::bar;
16-
static foo: *u8 = bar;
16+
static foo: extern "C" fn() = bar;
1717

1818
pub fn main() {
1919
assert_eq!(foo, cci_const::bar);

src/test/run-pass/const-extern-function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
extern fn foopy() {}
1212

13-
static f: *u8 = foopy;
13+
static f: extern "C" fn() = foopy;
1414
static s: S = S { f: foopy };
1515

1616
struct S {

src/test/run-pass/extern-call-deep.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
mod rustrt {
1212
pub extern {
13-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
14-
-> libc::uintptr_t;
13+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
14+
-> libc::uintptr_t,
15+
data: libc::uintptr_t)
16+
-> libc::uintptr_t;
1517
}
1618
}
1719

src/test/run-pass/extern-call-deep2.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
mod rustrt {
1212
pub extern {
13-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
14-
-> libc::uintptr_t;
13+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
14+
-> libc::uintptr_t,
15+
data: libc::uintptr_t)
16+
-> libc::uintptr_t;
1517
}
1618
}
1719

src/test/run-pass/extern-call-scrub.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
mod rustrt {
1616
pub extern {
17-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
18-
-> libc::uintptr_t;
17+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
18+
-> libc::uintptr_t,
19+
data: libc::uintptr_t)
20+
-> libc::uintptr_t;
1921
}
2022
}
2123

src/test/run-pass/extern-call.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
mod rustrt {
1212
pub extern {
13-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
13+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
14+
-> libc::uintptr_t,
15+
data: libc::uintptr_t)
1416
-> libc::uintptr_t;
1517
}
1618
}

src/test/run-pass/extern-stress.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
mod rustrt {
1515
pub extern {
16-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
17-
-> libc::uintptr_t;
16+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
17+
-> libc::uintptr_t,
18+
data: libc::uintptr_t)
19+
-> libc::uintptr_t;
1820
}
1921
}
2022

src/test/run-pass/extern-take-value.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ extern fn g() {
1515
}
1616

1717
pub fn main() {
18-
// extern functions are *u8 types
19-
let a: *u8 = f;
20-
let b: *u8 = f;
21-
let c: *u8 = g;
18+
// extern functions are extern function types
19+
let a: extern "C" fn() = f;
20+
let b: extern "C" fn() = f;
21+
let c: extern "C" fn() = g;
2222

2323
assert_eq!(a, b);
2424
assert!(a != c);

src/test/run-pass/extern-yield.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
mod rustrt {
1212
pub extern {
13-
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
14-
-> libc::uintptr_t;
13+
pub fn rust_dbg_call(cb: extern "C" fn(data: libc::uintptr_t)
14+
-> libc::uintptr_t,
15+
data: libc::uintptr_t)
16+
-> libc::uintptr_t;
1517
}
1618
}
1719

src/test/run-pass/float-nan.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010

1111
extern mod std;
1212

13-
use core::num::Float::{
14-
NaN, infinity, neg_infinity
15-
};
13+
use core::num::Float;
1614

1715
pub fn main() {
18-
let nan = NaN::<float>();
16+
let nan = Float::NaN::<float>();
1917
assert!((nan).is_NaN());
2018

21-
let inf = infinity::<float>();
22-
assert_eq!(-inf, neg_infinity::<float>());
19+
let inf = Float::infinity::<float>();
20+
assert_eq!(-inf, Float::neg_infinity::<float>());
2321

2422
assert!( nan != nan);
2523
assert!( nan != -nan);

src/test/run-pass/foreign-call-no-runtime.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use core::unstable::run_in_bare_thread;
22

33
extern {
4-
pub fn rust_dbg_call(cb: *u8,
4+
pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t)
5+
-> libc::uintptr_t,
56
data: libc::uintptr_t) -> libc::uintptr_t;
67
}
78

src/test/run-pass/static-method-xcrate.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414
extern mod static_methods_crate;
1515
use static_methods_crate::read;
16-
use readMaybeRenamed = static_methods_crate::read::readMaybe;
1716

1817
pub fn main() {
1918
let result: int = read(~"5");
2019
assert_eq!(result, 5);
21-
assert_eq!(readMaybeRenamed(~"false"), Some(false));
22-
assert_eq!(readMaybeRenamed(~"foo"), None::<bool>);
20+
assert_eq!(read::readMaybe(~"false"), Some(false));
21+
assert_eq!(read::readMaybe(~"foo"), None::<bool>);
2322
}

src/test/run-pass/trait-inheritance-num.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
extern mod std;
1414

1515
use core::cmp::{Eq, Ord};
16-
use core::num::NumCast::from;
16+
use core::num::NumCast;
1717

1818
pub trait NumExt: Num + NumCast + Eq + Ord {}
1919

2020
pub trait FloatExt: NumExt + ApproxEq<Self> {}
2121

22-
fn greater_than_one<T:NumExt>(n: &T) -> bool { *n > from(1) }
23-
fn greater_than_one_float<T:FloatExt>(n: &T) -> bool { *n > from(1) }
22+
fn greater_than_one<T:NumExt>(n: &T) -> bool { *n > NumCast::from(1) }
23+
fn greater_than_one_float<T:FloatExt>(n: &T) -> bool { *n > NumCast::from(1) }
2424

2525
pub fn main() {}

src/test/run-pass/trait-inheritance-num0.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// Extending Num and using inherited static methods
1414

15-
use core::num::NumCast::from;
15+
use core::num::NumCast;
1616

1717
trait Num {
1818
fn from_int(i: int) -> Self;
@@ -22,7 +22,7 @@ trait Num {
2222
pub trait NumExt: Num + NumCast { }
2323

2424
fn greater_than_one<T:NumExt>(n: &T) -> bool {
25-
n.gt(&from(1))
25+
n.gt(&NumCast::from(1))
2626
}
2727

2828
pub fn main() {}

src/test/run-pass/trait-inheritance-num1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
// except according to those terms.
1010

1111
use core::cmp::Ord;
12-
use core::num::NumCast::from;
12+
use core::num::NumCast;
1313

1414
pub trait NumExt: Num + NumCast + Ord { }
1515

1616
fn greater_than_one<T:NumExt>(n: &T) -> bool {
17-
*n > from(1)
17+
*n > NumCast::from(1)
1818
}
1919

2020
pub fn main() {}

src/test/run-pass/trait-inheritance-num2.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
extern mod std;
1616

1717
use core::cmp::{Eq, Ord};
18-
use core::num::NumCast::from;
1918

2019
pub trait TypeExt {}
2120

src/test/run-pass/trait-inheritance-num3.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
// except according to those terms.
1010

1111
use core::cmp::{Eq, Ord};
12-
use core::num::NumCast::from;
12+
use core::num::NumCast;
1313

1414
pub trait NumExt: Eq + Ord + Num + NumCast {}
1515

1616
impl NumExt for f32 {}
1717

18-
fn num_eq_one<T:NumExt>(n: T) { io::println(fmt!("%?", n == from(1))) }
18+
fn num_eq_one<T:NumExt>(n: T) {
19+
io::println(fmt!("%?", n == NumCast::from(1)))
20+
}
1921

2022
pub fn main() {
2123
num_eq_one(1f32); // you need to actually use the function to trigger the ICE

src/test/run-pass/trait-inheritance-num5.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
// except according to those terms.
1010

1111
use core::cmp::{Eq, Ord};
12-
use core::num::NumCast::from;
12+
use core::num::NumCast;
1313

1414
pub trait NumExt: Eq + Num + NumCast {}
1515

1616
impl NumExt for f32 {}
1717
impl NumExt for int {}
1818

1919
fn num_eq_one<T:NumExt>() -> T {
20-
from(1)
20+
NumCast::from(1)
2121
}
2222

2323
pub fn main() {

0 commit comments

Comments
 (0)