mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
test: Fix tests.
This commit is contained in:
parent
16a0125e41
commit
9d011ebf67
2
src/llvm
2
src/llvm
@ -1 +1 @@
|
||||
Subproject commit 2e9f0d21fe321849a4759a01fc28eae82ef196d6
|
||||
Subproject commit 56dd407f4f97a01b8df6554c569170d2fc276fcb
|
@ -23,7 +23,7 @@ pub mod kitties {
|
||||
fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
||||
pub fn cat<U>(in_x : uint, in_y : int, +in_info: ~[U]) -> cat<U> {
|
||||
pub fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y,
|
||||
|
@ -12,9 +12,9 @@
|
||||
// other tycons.
|
||||
|
||||
fn coerce(b: &fn()) -> extern fn() {
|
||||
fn lol(+f: extern fn(+v: &fn()) -> extern fn(),
|
||||
+g: &fn()) -> extern fn() { return f(g); }
|
||||
fn fn_id(+f: extern fn()) -> extern fn() { return f }
|
||||
fn lol(f: extern fn(+v: &fn()) -> extern fn(),
|
||||
g: &fn()) -> extern fn() { return f(g); }
|
||||
fn fn_id(f: extern fn()) -> extern fn() { return f }
|
||||
return lol(fn_id, b);
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn match_ref(&&v: Option<int>) -> int {
|
||||
fn match_ref(v: Option<int>) -> int {
|
||||
match v {
|
||||
Some(ref i) => {
|
||||
*i
|
||||
@ -17,7 +17,7 @@ fn match_ref(&&v: Option<int>) -> int {
|
||||
}
|
||||
}
|
||||
|
||||
fn match_ref_unused(&&v: Option<int>) {
|
||||
fn match_ref_unused(v: Option<int>) {
|
||||
match v {
|
||||
Some(_) => {}
|
||||
None => {}
|
||||
|
@ -8,13 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(+x: ~int) -> int {
|
||||
fn foo(x: ~int) -> int {
|
||||
let y = &*x;
|
||||
free(x); //~ ERROR cannot move out of `*x` because it is borrowed
|
||||
*y
|
||||
}
|
||||
|
||||
fn free(+_x: ~int) {
|
||||
fn free(_x: ~int) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -18,7 +18,7 @@ impl Drop for X {
|
||||
}
|
||||
}
|
||||
|
||||
fn unwrap(+x: X) -> ~str {
|
||||
fn unwrap(x: X) -> ~str {
|
||||
let X { x: y } = x; //~ ERROR deconstructing struct not allowed in pattern
|
||||
y
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ pub mod stream {
|
||||
use core::pipes;
|
||||
|
||||
pub impl<T:Owned> Stream<T> {
|
||||
pub fn recv() -> extern fn(+v: Stream<T>) -> ::stream::Stream<T> {
|
||||
pub fn recv() -> extern fn(v: Stream<T>) -> ::stream::Stream<T> {
|
||||
// resolve really should report just one error here.
|
||||
// Change the test case when it changes.
|
||||
pub fn recv(+pipe: Stream<T>) -> ::stream::Stream<T> { //~ ERROR attempt to use a type argument out of scope
|
||||
pub fn recv(pipe: Stream<T>) -> ::stream::Stream<T> { //~ ERROR attempt to use a type argument out of scope
|
||||
//~^ ERROR use of undeclared type name
|
||||
//~^^ ERROR attempt to use a type argument out of scope
|
||||
//~^^^ ERROR use of undeclared type name
|
||||
|
@ -18,7 +18,7 @@ struct Foo {
|
||||
a: ()
|
||||
}
|
||||
|
||||
fn deserialize_foo<__D: std::serialization::deserializer>(&&__d: __D) {
|
||||
fn deserialize_foo<__D: std::serialization::deserializer>(__d: __D) {
|
||||
}
|
||||
|
||||
fn main() { let des = Deserializer(); let foo = deserialize_foo(des); }
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn send<T:Owned>(ch: _chan<T>, +data: T) {
|
||||
fn send<T:Owned>(ch: _chan<T>, data: T) {
|
||||
debug!(ch);
|
||||
debug!(data);
|
||||
fail!();
|
||||
|
@ -11,7 +11,7 @@
|
||||
extern mod std;
|
||||
|
||||
fn main() {
|
||||
unsafe fn f(&&v: *const int) {
|
||||
unsafe fn f(v: *const int) {
|
||||
*v = 1 //~ ERROR cannot assign
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ impl Drop for r {
|
||||
}
|
||||
}
|
||||
|
||||
fn f<T>(+_i: ~[T], +_j: ~[T]) {
|
||||
fn f<T>(_i: ~[T], _j: ~[T]) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn getbig_and_fail(&&i: int) {
|
||||
fn getbig_and_fail(i: int) {
|
||||
let _r = and_then_get_big_again(5);
|
||||
if i != 0 {
|
||||
getbig_and_fail(i - 1);
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn getbig_and_fail(&&i: int) {
|
||||
fn getbig_and_fail(i: int) {
|
||||
let r = and_then_get_big_again(5);
|
||||
if i != 0 {
|
||||
getbig_and_fail(i - 1);
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// error-pattern:fail
|
||||
fn f(+_a: @int) {
|
||||
fn f(_a: @int) {
|
||||
fail!();
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,11 @@
|
||||
|
||||
// xfail-fast
|
||||
|
||||
struct X { x: int }
|
||||
struct X {
|
||||
x: int
|
||||
}
|
||||
|
||||
fn f1(a: &mut X, b: &mut int, +c: int) -> int {
|
||||
fn f1(a: &mut X, b: &mut int, c: int) -> int {
|
||||
let r = a.x + *b + c;
|
||||
a.x = 0;
|
||||
*b = 10;
|
||||
|
@ -9,11 +9,11 @@
|
||||
// except according to those terms.
|
||||
|
||||
trait Pushable<T> {
|
||||
fn push_val(&mut self, +t: T);
|
||||
fn push_val(&mut self, t: T);
|
||||
}
|
||||
|
||||
impl<T> Pushable<T> for ~[T] {
|
||||
fn push_val(&mut self, +t: T) {
|
||||
fn push_val(&mut self, t: T) {
|
||||
self.push(t);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
// xfail-fast
|
||||
extern mod std;
|
||||
use std::arc;
|
||||
fn dispose(+_x: arc::ARC<bool>) { unsafe { } }
|
||||
fn dispose(_x: arc::ARC<bool>) { unsafe { } }
|
||||
|
||||
pub fn main() {
|
||||
let p = arc::ARC(true);
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn borrow(_v: &int) {}
|
||||
|
||||
fn borrow_from_arg_imm_ref(&&v: ~int) {
|
||||
fn borrow_from_arg_imm_ref(v: ~int) {
|
||||
borrow(v);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ fn borrow_from_arg_mut_ref(v: &mut ~int) {
|
||||
borrow(*v);
|
||||
}
|
||||
|
||||
fn borrow_from_arg_copy(+v: ~int) {
|
||||
fn borrow_from_arg_copy(v: ~int) {
|
||||
borrow(v);
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ fn want_slice(v: &[int]) -> int {
|
||||
return sum;
|
||||
}
|
||||
|
||||
fn has_mut_vec(+v: ~[int]) -> int {
|
||||
fn has_mut_vec(v: ~[int]) -> int {
|
||||
want_slice(v)
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ impl frob for foo {
|
||||
}
|
||||
|
||||
// Override default mode so that we are passing by value
|
||||
fn really_impure(++bar: baz) {
|
||||
fn really_impure(bar: baz) {
|
||||
bar.baz = 3;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
use core::comm::*;
|
||||
|
||||
fn foo(&&x: ()) -> Port<()> {
|
||||
fn foo(x: ()) -> Port<()> {
|
||||
let (p, c) = stream::<()>();
|
||||
do task::spawn() {
|
||||
c.send(x);
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn child2(&&s: ~str) { }
|
||||
fn child2(s: ~str) { }
|
||||
|
||||
pub fn main() { let x = task::spawn(|| child2(~"hi") ); }
|
||||
pub fn main() {
|
||||
let x = task::spawn(|| child2(~"hi"));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ pub impl<U> cat<U> {
|
||||
fn meow_count(&mut self) -> uint { self.meows }
|
||||
}
|
||||
|
||||
fn cat<U>(in_x : uint, in_y : int, +in_info: ~[U]) -> cat<U> {
|
||||
fn cat<U>(in_x : uint, in_y : int, in_info: ~[U]) -> cat<U> {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y,
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-win32
|
||||
fn adder(+x: @int, +y: @int) -> int { return *x + *y; }
|
||||
fn adder(x: @int, y: @int) -> int { return *x + *y; }
|
||||
fn failer() -> @int { fail!(); }
|
||||
pub fn main() {
|
||||
assert!(result::is_err(&task::try(|| {
|
||||
|
@ -16,7 +16,7 @@ struct TwoU64s {
|
||||
}
|
||||
|
||||
pub extern {
|
||||
pub fn rust_dbg_extern_identity_TwoU64s(&&u: TwoU64s) -> TwoU64s;
|
||||
pub fn rust_dbg_extern_identity_TwoU64s(u: TwoU64s) -> TwoU64s;
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
extern {
|
||||
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
|
||||
++v: **vec::raw::VecRepr,
|
||||
++n: libc::size_t);
|
||||
pub unsafe fn vec_reserve_shared_actual(t: *sys::TypeDesc,
|
||||
v: **vec::raw::VecRepr,
|
||||
n: libc::size_t);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -14,7 +14,7 @@ fn spawn<T:Owned>(val: T, f: extern fn(T)) {
|
||||
f(val);
|
||||
}
|
||||
|
||||
fn f(+i: int) {
|
||||
fn f(i: int) {
|
||||
assert!(i == 100);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ mod bindgen {
|
||||
|
||||
#[nolink]
|
||||
pub extern {
|
||||
pub fn printf(++v: void);
|
||||
pub fn printf(v: void);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
mod rusti {
|
||||
#[abi = "rust-intrinsic"]
|
||||
pub extern "rust-intrinsic" {
|
||||
pub fn move_val_init<T>(dst: &mut T, +src: T);
|
||||
pub fn move_val<T>(dst: &mut T, +src: T);
|
||||
pub fn move_val_init<T>(dst: &mut T, src: T);
|
||||
pub fn move_val<T>(dst: &mut T, src: T);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn a_val(&&x: ~int, +y: ~int) -> int {
|
||||
fn a_val(x: ~int, y: ~int) -> int {
|
||||
*x + *y
|
||||
}
|
||||
|
||||
|
@ -53,23 +53,23 @@ pub mod pipes {
|
||||
|
||||
// We should consider moving this to ::core::unsafe, although I
|
||||
// suspect graydon would want us to use void pointers instead.
|
||||
pub unsafe fn uniquify<T>(+x: *T) -> ~T {
|
||||
pub unsafe fn uniquify<T>(x: *T) -> ~T {
|
||||
unsafe { cast::transmute(x) }
|
||||
}
|
||||
|
||||
pub fn swap_state_acq(+dst: &mut state, src: state) -> state {
|
||||
pub fn swap_state_acq(dst: &mut state, src: state) -> state {
|
||||
unsafe {
|
||||
transmute(rusti::atomic_xchg_acq(transmute(dst), src as int))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn swap_state_rel(+dst: &mut state, src: state) -> state {
|
||||
pub fn swap_state_rel(dst: &mut state, src: state) -> state {
|
||||
unsafe {
|
||||
transmute(rusti::atomic_xchg_rel(transmute(dst), src as int))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send<T:Owned>(mut p: send_packet<T>, +payload: T) {
|
||||
pub fn send<T:Owned>(mut p: send_packet<T>, payload: T) {
|
||||
let mut p = p.unwrap();
|
||||
let mut p = unsafe { uniquify(p) };
|
||||
assert!((*p).payload.is_none());
|
||||
@ -229,7 +229,7 @@ pub mod pingpong {
|
||||
pub struct ping(::pipes::send_packet<pong>);
|
||||
pub struct pong(::pipes::send_packet<ping>);
|
||||
|
||||
pub fn liberate_ping(+p: ping) -> ::pipes::send_packet<pong> {
|
||||
pub fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
|
||||
unsafe {
|
||||
let addr : *::pipes::send_packet<pong> = match &p {
|
||||
&ping(ref x) => { cast::transmute(x) }
|
||||
@ -240,7 +240,7 @@ pub mod pingpong {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn liberate_pong(+p: pong) -> ::pipes::send_packet<ping> {
|
||||
pub fn liberate_pong(p: pong) -> ::pipes::send_packet<ping> {
|
||||
unsafe {
|
||||
let addr : *::pipes::send_packet<ping> = match &p {
|
||||
&pong(ref x) => { cast::transmute(x) }
|
||||
@ -262,14 +262,14 @@ pub mod pingpong {
|
||||
pub type ping = ::pipes::send_packet<pingpong::ping>;
|
||||
pub type pong = ::pipes::recv_packet<pingpong::pong>;
|
||||
|
||||
pub fn do_ping(+c: ping) -> pong {
|
||||
pub fn do_ping(c: ping) -> pong {
|
||||
let (sp, rp) = ::pipes::entangle();
|
||||
|
||||
::pipes::send(c, pingpong::ping(sp));
|
||||
rp
|
||||
}
|
||||
|
||||
pub fn do_pong(+c: pong) -> (ping, ()) {
|
||||
pub fn do_pong(c: pong) -> (ping, ()) {
|
||||
let packet = ::pipes::recv(c);
|
||||
if packet.is_none() {
|
||||
fail!(~"sender closed the connection")
|
||||
@ -284,7 +284,7 @@ pub mod pingpong {
|
||||
pub type ping = ::pipes::recv_packet<pingpong::ping>;
|
||||
pub type pong = ::pipes::send_packet<pingpong::pong>;
|
||||
|
||||
pub fn do_ping(+c: ping) -> (pong, ()) {
|
||||
pub fn do_ping(c: ping) -> (pong, ()) {
|
||||
let packet = ::pipes::recv(c);
|
||||
if packet.is_none() {
|
||||
fail!(~"sender closed the connection")
|
||||
@ -292,7 +292,7 @@ pub mod pingpong {
|
||||
(pingpong::liberate_ping(packet.unwrap()), ())
|
||||
}
|
||||
|
||||
pub fn do_pong(+c: pong) -> ping {
|
||||
pub fn do_pong(c: pong) -> ping {
|
||||
let (sp, rp) = ::pipes::entangle();
|
||||
::pipes::send(c, pingpong::pong(sp));
|
||||
rp
|
||||
@ -300,14 +300,14 @@ pub mod pingpong {
|
||||
}
|
||||
}
|
||||
|
||||
fn client(+chan: pingpong::client::ping) {
|
||||
fn client(chan: pingpong::client::ping) {
|
||||
let chan = pingpong::client::do_ping(chan);
|
||||
error!(~"Sent ping");
|
||||
let (_chan, _data) = pingpong::client::do_pong(chan);
|
||||
error!(~"Received pong");
|
||||
}
|
||||
|
||||
fn server(+chan: pingpong::server::ping) {
|
||||
fn server(chan: pingpong::server::ping) {
|
||||
let (chan, _data) = pingpong::server::do_ping(chan);
|
||||
error!(~"Received ping");
|
||||
let _chan = pingpong::server::do_pong(chan);
|
||||
|
@ -59,7 +59,7 @@ fn square_from_char(c: char) -> square {
|
||||
}
|
||||
}
|
||||
|
||||
fn read_board_grid<rdr:'static + io::Reader>(+in: rdr) -> ~[~[square]] {
|
||||
fn read_board_grid<rdr:'static + io::Reader>(in: rdr) -> ~[~[square]] {
|
||||
let in = @in as @io::Reader;
|
||||
let mut grid = ~[];
|
||||
for in.each_line |line| {
|
||||
|
@ -24,7 +24,7 @@ struct KEYGEN {
|
||||
|
||||
extern {
|
||||
// Bogus signature, just need to test if it compiles.
|
||||
pub fn malloc(++data: KEYGEN);
|
||||
pub fn malloc(data: KEYGEN);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn is_even(&&x: uint) -> bool { (x % 2u) == 0u }
|
||||
fn is_even(x: uint) -> bool { (x % 2u) == 0u }
|
||||
|
||||
pub fn main() {
|
||||
assert!([1u, 3u].min() == 1u);
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn take(+x: int) -> int {x}
|
||||
fn take(x: int) -> int {x}
|
||||
|
||||
fn the_loop() {
|
||||
let mut list = ~[];
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn getbig(&&i: int) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn test(+foo: ~~[int]) { assert!((foo[0] == 10)); }
|
||||
fn test(foo: ~~[int]) { assert!((foo[0] == 10)); }
|
||||
|
||||
pub fn main() {
|
||||
let x = ~~[10];
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn test(+foo: @~[int]) { assert!((foo[0] == 10)); }
|
||||
fn test(foo: @~[int]) { assert!((foo[0] == 10)); }
|
||||
|
||||
pub fn main() {
|
||||
let x = @~[10];
|
||||
|
@ -8,6 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn test(+foo: int) { assert!((foo == 10)); }
|
||||
fn test(foo: int) { assert!((foo == 10)); }
|
||||
|
||||
pub fn main() { let x = 10; test(x); }
|
||||
|
@ -9,9 +9,9 @@
|
||||
// except according to those terms.
|
||||
|
||||
// Issue #922
|
||||
fn f2(+thing: @fn()) { }
|
||||
fn f2(thing: @fn()) { }
|
||||
|
||||
fn f(+thing: @fn()) {
|
||||
fn f(thing: @fn()) {
|
||||
f2(thing);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ impl ops::Not<Point> for Point {
|
||||
}
|
||||
|
||||
impl ops::Index<bool,int> for Point {
|
||||
fn index(&self, +x: &bool) -> int {
|
||||
fn index(&self, x: &bool) -> int {
|
||||
if *x { self.x } else { self.y }
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ impl Drop for dtor {
|
||||
}
|
||||
}
|
||||
|
||||
fn unwrap<T>(+o: Option<T>) -> T {
|
||||
fn unwrap<T>(o: Option<T>) -> T {
|
||||
match o {
|
||||
Some(v) => v,
|
||||
None => fail!()
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn magic(+x: A) { debug!(x); }
|
||||
fn magic2(+x: @int) { debug!(x); }
|
||||
fn magic(x: A) { debug!(x); }
|
||||
fn magic2(x: @int) { debug!(x); }
|
||||
|
||||
struct A { a: @int }
|
||||
|
||||
|
@ -48,12 +48,12 @@ macro_rules! move_it (
|
||||
{ $x:expr } => { unsafe { let y = *ptr::to_unsafe_ptr(&($x)); y } }
|
||||
)
|
||||
|
||||
fn switch<T:Owned,U>(+endp: pipes::RecvPacket<T>,
|
||||
f: &fn(+v: Option<T>) -> U) -> U {
|
||||
fn switch<T:Owned,U>(endp: pipes::RecvPacket<T>,
|
||||
f: &fn(v: Option<T>) -> U) -> U {
|
||||
f(pipes::try_recv(endp))
|
||||
}
|
||||
|
||||
fn move_it<T>(+x: T) -> T { x }
|
||||
fn move_it<T>(x: T) -> T { x }
|
||||
|
||||
macro_rules! follow (
|
||||
{
|
||||
@ -68,7 +68,7 @@ macro_rules! follow (
|
||||
);
|
||||
)
|
||||
|
||||
fn client_follow(+bank: bank::client::login) {
|
||||
fn client_follow(bank: bank::client::login) {
|
||||
use bank::*;
|
||||
|
||||
let bank = client::login(bank, ~"theincredibleholk", ~"1234");
|
||||
@ -89,7 +89,7 @@ fn client_follow(+bank: bank::client::login) {
|
||||
));
|
||||
}
|
||||
|
||||
fn bank_client(+bank: bank::client::login) {
|
||||
fn bank_client(bank: bank::client::login) {
|
||||
use bank::*;
|
||||
|
||||
let bank = client::login(bank, ~"theincredibleholk", ~"1234");
|
||||
|
@ -91,7 +91,7 @@ mod test {
|
||||
use core::pipes::recv;
|
||||
use pingpong::{ping, pong};
|
||||
|
||||
pub fn client(+chan: ::pingpong::client::ping) {
|
||||
pub fn client(chan: ::pingpong::client::ping) {
|
||||
use pingpong::client;
|
||||
|
||||
let chan = client::ping(chan); return;
|
||||
@ -100,7 +100,7 @@ mod test {
|
||||
error!("Received pong");
|
||||
}
|
||||
|
||||
pub fn server(+chan: ::pingpong::server::ping) {
|
||||
pub fn server(chan: ::pingpong::server::ping) {
|
||||
use pingpong::server;
|
||||
|
||||
let ping(chan) = recv(chan); return;
|
||||
|
@ -29,7 +29,7 @@ mod test {
|
||||
use core::pipes::recv;
|
||||
use pingpong::{ping, pong};
|
||||
|
||||
pub fn client(+chan: ::pingpong::client::ping) {
|
||||
pub fn client(chan: ::pingpong::client::ping) {
|
||||
use pingpong::client;
|
||||
|
||||
let chan = client::ping(chan);
|
||||
@ -38,7 +38,7 @@ mod test {
|
||||
error!(~"Received pong");
|
||||
}
|
||||
|
||||
pub fn server(+chan: ::pingpong::server::ping) {
|
||||
pub fn server(chan: ::pingpong::server::ping) {
|
||||
use pingpong::server;
|
||||
|
||||
let ping(chan) = recv(chan);
|
||||
|
@ -633,7 +633,7 @@ impl TyVisitor for my_visitor {
|
||||
fn visit_closure_ptr(&self, _ck: uint) -> bool { true }
|
||||
}
|
||||
|
||||
fn get_tydesc_for<T>(&&_t: T) -> *TyDesc {
|
||||
fn get_tydesc_for<T>(_t: T) -> *TyDesc {
|
||||
get_tydesc::<T>()
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ struct closure_box<'self> {
|
||||
cl: &'self fn(),
|
||||
}
|
||||
|
||||
fn box_it<'r>(+x: &'r fn()) -> closure_box<'r> {
|
||||
fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
|
||||
closure_box {cl: x}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ struct closure_box<'self> {
|
||||
cl: &'self fn(),
|
||||
}
|
||||
|
||||
fn box_it<'r>(+x: &'r fn()) -> closure_box<'r> {
|
||||
fn box_it<'r>(x: &'r fn()) -> closure_box<'r> {
|
||||
closure_box {cl: x}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use core::cell::Cell;
|
||||
|
||||
pub fn main() { test05(); }
|
||||
|
||||
fn test05_start(&&f: ~fn(int)) {
|
||||
fn test05_start(f: ~fn(int)) {
|
||||
f(22);
|
||||
}
|
||||
|
||||
|
@ -17,4 +17,4 @@ pub fn main() {
|
||||
task::spawn(|| child(10) );
|
||||
}
|
||||
|
||||
fn child(&&i: int) { error!(i); assert!((i == 10)); }
|
||||
fn child(i: int) { error!(i); assert!((i == 10)); }
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
pub fn main() { task::spawn(|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); }
|
||||
|
||||
fn child(&&args: (int, int, int, int, int, int, int, int, int)) {
|
||||
fn child(args: (int, int, int, int, int, int, int, int, int)) {
|
||||
let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args;
|
||||
error!(i1);
|
||||
error!(i2);
|
||||
|
@ -13,7 +13,7 @@
|
||||
// A trait for objects that can be used to do an if-then-else
|
||||
// (No actual need for this to be static, but it is a simple test.)
|
||||
trait bool_like {
|
||||
fn select<A>(b: Self, +x1: A, +x2: A) -> A;
|
||||
fn select<A>(b: Self, x1: A, x2: A) -> A;
|
||||
}
|
||||
|
||||
fn andand<T:bool_like + Copy>(x1: T, x2: T) -> T {
|
||||
@ -21,38 +21,38 @@ fn andand<T:bool_like + Copy>(x1: T, x2: T) -> T {
|
||||
}
|
||||
|
||||
impl bool_like for bool {
|
||||
fn select<A>(&&b: bool, +x1: A, +x2: A) -> A {
|
||||
fn select<A>(b: bool, x1: A, x2: A) -> A {
|
||||
if b { x1 } else { x2 }
|
||||
}
|
||||
}
|
||||
|
||||
impl bool_like for int {
|
||||
fn select<A>(&&b: int, +x1: A, +x2: A) -> A {
|
||||
fn select<A>(b: int, x1: A, x2: A) -> A {
|
||||
if b != 0 { x1 } else { x2 }
|
||||
}
|
||||
}
|
||||
|
||||
// A trait for sequences that can be constructed imperatively.
|
||||
trait buildable<A> {
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(+v: A))) -> Self;
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(v: A))) -> Self;
|
||||
}
|
||||
|
||||
|
||||
impl<A> buildable<A> for @[A] {
|
||||
#[inline(always)]
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(+v: A))) -> @[A] {
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(v: A))) -> @[A] {
|
||||
at_vec::build_sized(size, builder)
|
||||
}
|
||||
}
|
||||
impl<A> buildable<A> for ~[A] {
|
||||
#[inline(always)]
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(+v: A))) -> ~[A] {
|
||||
fn build_sized(size: uint, builder: &fn(push: &fn(v: A))) -> ~[A] {
|
||||
vec::build_sized(size, builder)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn build<A, B: buildable<A>>(builder: &fn(push: &fn(+v: A))) -> B {
|
||||
fn build<A, B: buildable<A>>(builder: &fn(push: &fn(v: A))) -> B {
|
||||
buildable::build_sized(4, builder)
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@ mod rustrt {
|
||||
|
||||
#[nolink]
|
||||
pub extern {
|
||||
pub fn debug_abi_1(++q: Quad) -> Quad;
|
||||
pub fn debug_abi_2(++f: Floats) -> Floats;
|
||||
pub fn debug_abi_1(q: Quad) -> Quad;
|
||||
pub fn debug_abi_2(f: Floats) -> Floats;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ extern mod std;
|
||||
|
||||
pub fn main() { test00(); }
|
||||
|
||||
fn start(&&task_number: int) { debug!("Started / Finished task."); }
|
||||
fn start(task_number: int) { debug!("Started / Finished task."); }
|
||||
|
||||
fn test00() {
|
||||
let i: int = 0;
|
||||
|
@ -13,6 +13,6 @@ pub fn main() {
|
||||
task::spawn(|| child(~"Hello") );
|
||||
}
|
||||
|
||||
fn child(&&s: ~str) {
|
||||
fn child(s: ~str) {
|
||||
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ pub fn main() {
|
||||
debug!("main thread exiting");
|
||||
}
|
||||
|
||||
fn child(&&x: int) { debug!(x); }
|
||||
fn child(x: int) { debug!(x); }
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn f(+i: ~int) {
|
||||
fn f(i: ~int) {
|
||||
assert!(*i == 100);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
pub fn main() {
|
||||
let mut result = None;
|
||||
let mut builder = task::task();
|
||||
builder.future_result(|+r| { result = Some(r); });
|
||||
builder.future_result(|r| { result = Some(r); });
|
||||
builder.spawn(child);
|
||||
error!("1");
|
||||
task::yield();
|
||||
|
@ -12,7 +12,7 @@
|
||||
pub fn main() {
|
||||
let mut result = None;
|
||||
let mut builder = task::task();
|
||||
builder.future_result(|+r| { result = Some(r); });
|
||||
builder.future_result(|r| { result = Some(r); });
|
||||
builder.spawn(child);
|
||||
error!("1");
|
||||
task::yield();
|
||||
|
Loading…
Reference in New Issue
Block a user