mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Fix run-pass tests to have 'pub fn main'
This is required by the check-fast target because each test is slurped up into a submodule.
This commit is contained in:
parent
10a583ce1a
commit
30862a64c2
@ -29,6 +29,8 @@ for t in os.listdir(run_pass):
|
|||||||
if not ("xfail-test" in s or
|
if not ("xfail-test" in s or
|
||||||
"xfail-fast" in s or
|
"xfail-fast" in s or
|
||||||
"xfail-win32" in s):
|
"xfail-win32" in s):
|
||||||
|
if not "pub fn main" in s and "fn main" in s:
|
||||||
|
print("Warning: no public entry point in " + t)
|
||||||
stage2_tests.append(t)
|
stage2_tests.append(t)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
@ -20,6 +20,6 @@ impl<T> Drop for Test<T> {
|
|||||||
fn drop(&mut self) { }
|
fn drop(&mut self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(size_of::<int>(), size_of::<Test<int>>());
|
assert_eq!(size_of::<int>(), size_of::<Test<int>>());
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,4 @@ impl Foo {
|
|||||||
fn check_id(&mut self, s: int) { fail!() }
|
fn check_id(&mut self, s: int) { fail!() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -43,5 +43,5 @@ fn match_mut_reg(v: &mut Option<int>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
// Regression test for issue #7740
|
// Regression test for issue #7740
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
static A: &'static char = &'A';
|
static A: &'static char = &'A';
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ fn noncopyable() -> noncopyable {
|
|||||||
|
|
||||||
struct wrapper(noncopyable);
|
struct wrapper(noncopyable);
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let x1 = wrapper(noncopyable());
|
let x1 = wrapper(noncopyable());
|
||||||
let _x2 = *x1;
|
let _x2 = *x1;
|
||||||
}
|
}
|
||||||
|
@ -50,5 +50,5 @@ fn box_imm_recs(v: &Outer) {
|
|||||||
borrow(v.f.g.h); // OK
|
borrow(v.f.g.h); // OK
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
|
// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let a = @mut 3i;
|
let a = @mut 3i;
|
||||||
let b = @mut [a];
|
let b = @mut [a];
|
||||||
let c = @mut [3];
|
let c = @mut [3];
|
||||||
|
@ -33,7 +33,7 @@ impl<T: Speak> Speak for Option<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(3.hi(), ~"hello: 3");
|
assert_eq!(3.hi(), ~"hello: 3");
|
||||||
assert_eq!(Some(Some(3)).hi(), ~"something!something!hello: 3");
|
assert_eq!(Some(Some(3)).hi(), ~"something!something!hello: 3");
|
||||||
assert_eq!(None::<int>.hi(), ~"hello - none");
|
assert_eq!(None::<int>.hi(), ~"hello - none");
|
||||||
|
@ -26,7 +26,7 @@ fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
|
|||||||
chan.send(val);
|
chan.send(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let (p,c) = comm::stream();
|
let (p,c) = comm::stream();
|
||||||
foo(31337, c);
|
foo(31337, c);
|
||||||
assert!(p.recv() == 31337);
|
assert!(p.recv() == 31337);
|
||||||
|
@ -22,7 +22,7 @@ fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
|
|||||||
chan.send(val);
|
chan.send(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let (p,c) = comm::stream();
|
let (p,c) = comm::stream();
|
||||||
foo(31337, c);
|
foo(31337, c);
|
||||||
assert!(p.recv() == 31337);
|
assert!(p.recv() == 31337);
|
||||||
|
@ -18,4 +18,4 @@ struct X<T>(());
|
|||||||
|
|
||||||
impl <T> Foo for X<T> { }
|
impl <T> Foo for X<T> { }
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -21,7 +21,7 @@ trait Foo : Send {
|
|||||||
|
|
||||||
impl <T: Send> Foo for T { }
|
impl <T: Send> Foo for T { }
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let (p,c) = comm::stream();
|
let (p,c) = comm::stream();
|
||||||
1193182.foo(c);
|
1193182.foo(c);
|
||||||
assert!(p.recv() == 1193182);
|
assert!(p.recv() == 1193182);
|
||||||
|
@ -14,4 +14,4 @@ trait Foo : Send { }
|
|||||||
|
|
||||||
impl Foo for int { }
|
impl Foo for int { }
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -15,4 +15,4 @@ trait Foo : Send { }
|
|||||||
|
|
||||||
impl <T: Send> Foo for T { }
|
impl <T: Send> Foo for T { }
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -25,10 +25,10 @@ fn bar(t: @mut T) {
|
|||||||
t.foo();
|
t.foo();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let s = @mut S { unused: 0 };
|
let s = @mut S { unused: 0 };
|
||||||
let s2 = s as @mut T;
|
let s2 = s as @mut T;
|
||||||
s2.foo();
|
s2.foo();
|
||||||
bar(s2);
|
bar(s2);
|
||||||
bar(s as @mut T);
|
bar(s as @mut T);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ fn foo(blk: ~fn:Send()) {
|
|||||||
blk();
|
blk();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let (p,c) = comm::stream();
|
let (p,c) = comm::stream();
|
||||||
do foo {
|
do foo {
|
||||||
c.send(());
|
c.send(());
|
||||||
|
@ -56,7 +56,7 @@ static am: bool = 2 > 1;
|
|||||||
static an: bool = 2 > -2;
|
static an: bool = 2 > -2;
|
||||||
static ao: bool = 1.0 > -2.0;
|
static ao: bool = 1.0 > -2.0;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(a, -1);
|
assert_eq!(a, -1);
|
||||||
assert_eq!(a2, 6);
|
assert_eq!(a2, 6);
|
||||||
assert_approx_eq!(b, 5.7);
|
assert_approx_eq!(b, 5.7);
|
||||||
|
@ -10,4 +10,4 @@ struct Bar {
|
|||||||
|
|
||||||
static bar: Bar = Bar { i: 0, v: IntVal(0) };
|
static bar: Bar = Bar { i: 0, v: IntVal(0) };
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -12,4 +12,4 @@ trait Foo {
|
|||||||
fn m(&self, _:int) { }
|
fn m(&self, _:int) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -31,6 +31,6 @@ impl Y for int {
|
|||||||
|
|
||||||
impl Z for int;
|
impl Z for int;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(12.x(), 12);
|
assert_eq!(12.x(), 12);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ enum E<T,U> {
|
|||||||
C
|
C
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _ = A::<int, int>(1i).clone();
|
let _ = A::<int, int>(1i).clone();
|
||||||
let _ = B(1i, 1.234).deep_clone();
|
let _ = B(1i, 1.234).deep_clone();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@
|
|||||||
#[deriving(Clone, DeepClone)]
|
#[deriving(Clone, DeepClone)]
|
||||||
struct S<T>(T, ());
|
struct S<T>(T, ());
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _ = S(1i, ()).clone().deep_clone();
|
let _ = S(1i, ()).clone().deep_clone();
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,4 @@ struct S {
|
|||||||
_nil: ()
|
_nil: ()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -35,7 +35,7 @@ struct ShortCircuit {
|
|||||||
y: FailCmp
|
y: FailCmp
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let a = ShortCircuit { x: 1, y: FailCmp };
|
let a = ShortCircuit { x: 1, y: FailCmp };
|
||||||
let b = ShortCircuit { x: 2, y: FailCmp };
|
let b = ShortCircuit { x: 2, y: FailCmp };
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ struct A<'self> {
|
|||||||
x: &'self int
|
x: &'self int
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let a = A { x: &1 };
|
let a = A { x: &1 };
|
||||||
let b = A { x: &2 };
|
let b = A { x: &2 };
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ impl ToStr for Custom {
|
|||||||
fn to_str(&self) -> ~str { ~"yay" }
|
fn to_str(&self) -> ~str { ~"yay" }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(B1.to_str(), ~"B1");
|
assert_eq!(B1.to_str(), ~"B1");
|
||||||
assert_eq!(B2.to_str(), ~"B2");
|
assert_eq!(B2.to_str(), ~"B2");
|
||||||
assert_eq!(C1(3).to_str(), ~"C1(3)");
|
assert_eq!(C1(3).to_str(), ~"C1(3)");
|
||||||
|
@ -33,7 +33,7 @@ struct Lots {
|
|||||||
j: (),
|
j: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let lots: Lots = Zero::zero();
|
let lots: Lots = Zero::zero();
|
||||||
assert!(lots.is_zero());
|
assert!(lots.is_zero());
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ enum Hero {
|
|||||||
Spiderman = -4
|
Spiderman = -4
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let pet: Animal = Snake;
|
let pet: Animal = Snake;
|
||||||
let hero: Hero = Superman;
|
let hero: Hero = Superman;
|
||||||
assert!(pet as uint == 3);
|
assert!(pet as uint == 3);
|
||||||
|
@ -15,7 +15,7 @@ enum Flopsy {
|
|||||||
static BAR:uint = Bunny as uint;
|
static BAR:uint = Bunny as uint;
|
||||||
static BAR2:uint = BAR;
|
static BAR2:uint = BAR;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _v = [0, .. Bunny as uint];
|
let _v = [0, .. Bunny as uint];
|
||||||
let _v = [0, .. BAR];
|
let _v = [0, .. BAR];
|
||||||
let _v = [0, .. BAR2];
|
let _v = [0, .. BAR2];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::io::println;
|
use std::io::println;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let v: ~[int] = ~[ 1, ..5 ];
|
let v: ~[int] = ~[ 1, ..5 ];
|
||||||
println(v[0].to_str());
|
println(v[0].to_str());
|
||||||
println(v[1].to_str());
|
println(v[1].to_str());
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
extern fn f(x: uint) -> uint { x * 2 }
|
extern fn f(x: uint) -> uint { x * 2 }
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
#[fixed_stack_segment];
|
#[fixed_stack_segment];
|
||||||
|
|
||||||
let x = f(22);
|
let x = f(22);
|
||||||
|
@ -19,7 +19,7 @@ extern fn uintvoidret(_x: uint) {}
|
|||||||
|
|
||||||
extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z }
|
extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z }
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(voidret1, voidret1);
|
assert_eq!(voidret1, voidret1);
|
||||||
assert!(voidret1 != voidret2);
|
assert!(voidret1 != voidret2);
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none());
|
assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none());
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
// Make sure that this view item is filtered out because otherwise it would
|
// Make sure that this view item is filtered out because otherwise it would
|
||||||
// trigger a compilation error
|
// trigger a compilation error
|
||||||
#[cfg(not_present)] use foo = bar;
|
#[cfg(not_present)] use foo = bar;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let x = [1,..100];
|
let x = [1,..100];
|
||||||
let mut y = 0;
|
let mut y = 0;
|
||||||
for i in x.iter() {
|
for i in x.iter() {
|
||||||
|
@ -14,7 +14,7 @@ use std::hashmap::HashMap;
|
|||||||
// outside the loop, breaks, then _picks back up_ and continues
|
// outside the loop, breaks, then _picks back up_ and continues
|
||||||
// iterating with it.
|
// iterating with it.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let mut h = HashMap::new();
|
let mut h = HashMap::new();
|
||||||
let kvs = [(1, 10), (2, 20), (3, 30)];
|
let kvs = [(1, 10), (2, 20), (3, 30)];
|
||||||
for &(k,v) in kvs.iter() {
|
for &(k,v) in kvs.iter() {
|
||||||
@ -38,4 +38,4 @@ fn main() {
|
|||||||
|
|
||||||
assert_eq!(x, 6);
|
assert_eq!(x, 6);
|
||||||
assert_eq!(y, 60);
|
assert_eq!(y, 60);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
use std::hashmap::HashMap;
|
use std::hashmap::HashMap;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let mut h = HashMap::new();
|
let mut h = HashMap::new();
|
||||||
let kvs = [(1, 10), (2, 20), (3, 30)];
|
let kvs = [(1, 10), (2, 20), (3, 30)];
|
||||||
for &(k,v) in kvs.iter() {
|
for &(k,v) in kvs.iter() {
|
||||||
@ -24,4 +24,4 @@ fn main() {
|
|||||||
}
|
}
|
||||||
assert_eq!(x, 6);
|
assert_eq!(x, 6);
|
||||||
assert_eq!(y, 60);
|
assert_eq!(y, 60);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let x = [1,..100];
|
let x = [1,..100];
|
||||||
let mut y = 0;
|
let mut y = 0;
|
||||||
for (n,i) in x.iter().enumerate() {
|
for (n,i) in x.iter().enumerate() {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let x = [1,..100];
|
let x = [1,..100];
|
||||||
let y = [2,..100];
|
let y = [2,..100];
|
||||||
let mut p = 0;
|
let mut p = 0;
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let x = [1,..100];
|
let x = [1,..100];
|
||||||
let mut y = 0;
|
let mut y = 0;
|
||||||
for i in x.iter() {
|
for i in x.iter() {
|
||||||
y += *i
|
y += *i
|
||||||
}
|
}
|
||||||
assert!(y == 100);
|
assert!(y == 100);
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@ fn foo(Foo {x, _}: Foo) -> *uint {
|
|||||||
addr
|
addr
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let obj = ~1;
|
let obj = ~1;
|
||||||
let objptr: *uint = &*obj;
|
let objptr: *uint = &*obj;
|
||||||
let f = Foo {x: obj, y: ~2};
|
let f = Foo {x: obj, y: ~2};
|
||||||
let xptr = foo(f);
|
let xptr = foo(f);
|
||||||
assert_eq!(objptr, xptr);
|
assert_eq!(objptr, xptr);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ fn checkval(~ref x: ~uint) -> uint {
|
|||||||
*x
|
*x
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let obj = ~1;
|
let obj = ~1;
|
||||||
let objptr: *uint = &*obj;
|
let objptr: *uint = &*obj;
|
||||||
let xptr = getaddr(obj);
|
let xptr = getaddr(obj);
|
||||||
|
@ -5,6 +5,6 @@ fn foo((x, _): (int, int)) -> int {
|
|||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(foo((22, 23)), 22);
|
assert_eq!(foo((22, 23)), 22);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@ impl<T> vec_utils<T> for ~[T] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(vec_utils::map_(&~[1,2,3], |&x| x+1), ~[2,3,4]);
|
assert_eq!(vec_utils::map_(&~[1,2,3], |&x| x+1), ~[2,3,4]);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ mod x {
|
|||||||
pub fn g() -> uint {14}
|
pub fn g() -> uint {14}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(){
|
pub fn main(){
|
||||||
// should *not* shadow the module x:
|
// should *not* shadow the module x:
|
||||||
let x = 9;
|
let x = 9;
|
||||||
// use it to avoid warnings:
|
// use it to avoid warnings:
|
||||||
|
@ -23,4 +23,4 @@ impl A for E {
|
|||||||
fn b<F,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but
|
fn b<F,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -18,4 +18,4 @@ impl HasNested {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let stdout = &io::stdout() as &io::WriterUtil;
|
let stdout = &io::stdout() as &io::WriterUtil;
|
||||||
stdout.write_line("Hello!");
|
stdout.write_line("Hello!");
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let (port, chan) = stream();
|
let (port, chan) = stream();
|
||||||
|
|
||||||
do spawn {
|
do spawn {
|
||||||
|
@ -21,7 +21,7 @@ impl Drop for NonCopyable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let t = ~0;
|
let t = ~0;
|
||||||
let p = unsafe { transmute::<~int, *c_void>(t) };
|
let p = unsafe { transmute::<~int, *c_void>(t) };
|
||||||
let _z = NonCopyable(p);
|
let _z = NonCopyable(p);
|
||||||
|
@ -37,7 +37,7 @@ fn print_name(x: &Debuggable)
|
|||||||
println(fmt!("debug_name = %s", x.debug_name()));
|
println(fmt!("debug_name = %s", x.debug_name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let thing = Thing::new();
|
let thing = Thing::new();
|
||||||
print_name(&thing as &Debuggable);
|
print_name(&thing as &Debuggable);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ macro_rules! print_hd_tl (
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
print_hd_tl!(x, y, z, w)
|
print_hd_tl!(x, y, z, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,6 @@ impl Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _sched = Scheduler::new(~UvEventLoop::new() as ~EventLoop);
|
let _sched = Scheduler::new(~UvEventLoop::new() as ~EventLoop);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// Regression test for issue #5239
|
// Regression test for issue #5239
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _f: &fn(int) -> int = |ref x: int| { *x };
|
let _f: &fn(int) -> int = |ref x: int| { *x };
|
||||||
let foo = 10;
|
let foo = 10;
|
||||||
assert!(_f(foo) == 10);
|
assert!(_f(foo) == 10);
|
||||||
|
@ -20,6 +20,6 @@ impl FontTableTagConversions for FontTableTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
5.tag_to_str();
|
5.tag_to_str();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
struct A(bool);
|
struct A(bool);
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let f = A;
|
let f = A;
|
||||||
f(true);
|
f(true);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,6 @@ impl Fooable for uint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
2.yes();
|
2.yes();
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,4 @@ fn gl_err_str(err: u32) -> ~str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let box1 = @mut 42;
|
let box1 = @mut 42;
|
||||||
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
|
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#[allow(dead_assignment)];
|
#[allow(dead_assignment)];
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let s: ~str = ~"foobar";
|
let s: ~str = ~"foobar";
|
||||||
let mut t: &str = s;
|
let mut t: &str = s;
|
||||||
t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe
|
t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
fn foo<T: ::std::cmp::Eq>(_t: T) { }
|
fn foo<T: ::std::cmp::Eq>(_t: T) { }
|
||||||
|
|
||||||
fn main() { }
|
pub fn main() { }
|
||||||
|
@ -19,7 +19,7 @@ failed to typecheck correctly.
|
|||||||
|
|
||||||
struct X { vec: &'static [int] }
|
struct X { vec: &'static [int] }
|
||||||
static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
|
static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
|
||||||
fn main() {
|
pub fn main() {
|
||||||
for &v in V.iter() {
|
for &v in V.iter() {
|
||||||
println(fmt!("%?", v.vec));
|
println(fmt!("%?", v.vec));
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ impl<'self> Outer<'self> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let inner = 5;
|
let inner = 5;
|
||||||
let outer = Outer::new(&inner as &Inner);
|
let outer = Outer::new(&inner as &Inner);
|
||||||
outer.inner.print();
|
outer.inner.print();
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
return;
|
return;
|
||||||
while io::stdin().read_line() != ~"quit" { };
|
while io::stdin().read_line() != ~"quit" { };
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
struct T (&'static [int]);
|
struct T (&'static [int]);
|
||||||
static t : T = T (&'static [5, 4, 3]);
|
static t : T = T (&'static [5, 4, 3]);
|
||||||
fn main () {
|
pub fn main () {
|
||||||
assert_eq!(t[0], 5);
|
assert_eq!(t[0], 5);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ impl<E> Graph<int, E> for HashMap<int, int> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let g : ~HashMap<int, int> = ~HashMap::new();
|
let g : ~HashMap<int, int> = ~HashMap::new();
|
||||||
let _g2 : ~Graph<int,int> = g as ~Graph<int,int>;
|
let _g2 : ~Graph<int,int> = g as ~Graph<int,int>;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#[deny(type_limits)];
|
#[deny(type_limits)];
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let i: uint = 0;
|
let i: uint = 0;
|
||||||
assert!(i <= 0xFFFF_FFFF_u);
|
assert!(i <= 0xFFFF_FFFF_u);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ fn run(f: &fn()) {
|
|||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let f: ~fn() = || ();
|
let f: ~fn() = || ();
|
||||||
run(f);
|
run(f);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ fn swap(f: &fn(~[int]) -> ~[int]) -> ~[int] {
|
|||||||
f(x)
|
f(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let v = swap(|mut x| { x.push(4); x });
|
let v = swap(|mut x| { x.push(4); x });
|
||||||
let w = do swap |mut x| { x.push(4); x };
|
let w = do swap |mut x| { x.push(4); x };
|
||||||
assert_eq!(v, w);
|
assert_eq!(v, w);
|
||||||
|
@ -15,4 +15,4 @@ impl Drop for A {
|
|||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -13,7 +13,7 @@ impl Drop for A {
|
|||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let a = A { x: 0 };
|
let a = A { x: 0 };
|
||||||
|
|
||||||
let A { x: ref x } = a;
|
let A { x: ref x } = a;
|
||||||
|
@ -13,7 +13,7 @@ impl Drop for A {
|
|||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let a = A { x: 0 };
|
let a = A { x: 0 };
|
||||||
|
|
||||||
match a {
|
match a {
|
||||||
|
@ -21,7 +21,7 @@ static test1: signature<'static> = signature {
|
|||||||
pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]
|
pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]
|
||||||
};
|
};
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32];
|
let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32];
|
||||||
println(fmt!("%b",test==test1.pattern));
|
println(fmt!("%b",test==test1.pattern));
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ fn baz() {
|
|||||||
if "" == "" {}
|
if "" == "" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
bar();
|
bar();
|
||||||
baz();
|
baz();
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
|
|
||||||
fn foo(():()) { }
|
fn foo(():()) { }
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
foo(());
|
foo(());
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
|
||||||
trait A {}
|
trait A {}
|
||||||
impl<T: 'static> A for T {}
|
impl<T: 'static> A for T {}
|
||||||
|
@ -20,6 +20,6 @@ struct MyStruct;
|
|||||||
|
|
||||||
impl TraitWithDefaultMethod for MyStruct { }
|
impl TraitWithDefaultMethod for MyStruct { }
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
MyStruct.method();
|
MyStruct.method();
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,4 @@ trait TragicallySelfIsNotSend: Send {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(){}
|
pub fn main(){}
|
||||||
|
@ -14,7 +14,7 @@ impl A for B {}
|
|||||||
|
|
||||||
fn foo(_: &mut A) {}
|
fn foo(_: &mut A) {}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let mut b = B;
|
let mut b = B;
|
||||||
foo(&mut b as &mut A);
|
foo(&mut b as &mut A);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,6 @@ fn foo(a: &mut A) {
|
|||||||
C{ foo: a };
|
C{ foo: a };
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,5 +14,5 @@ fn foo(a: &mut io::Writer) {
|
|||||||
a.write([])
|
a.write([])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(){}
|
pub fn main(){}
|
||||||
|
|
||||||
|
@ -16,4 +16,4 @@ fn decode() -> ~str {
|
|||||||
~""
|
~""
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -19,4 +19,4 @@ macro_rules! silly_macro(
|
|||||||
|
|
||||||
silly_macro!()
|
silly_macro!()
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
fn main() {
|
pub fn main() {
|
||||||
let x = ~"hello";
|
let x = ~"hello";
|
||||||
let ref y = x;
|
let ref y = x;
|
||||||
assert_eq!(x.slice(0, x.len()), y.slice(0, y.len()));
|
assert_eq!(x.slice(0, x.len()), y.slice(0, y.len()));
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// shouldn't affect evaluation of $ex:
|
// shouldn't affect evaluation of $ex:
|
||||||
macro_rules! bad_macro (($ex:expr) => ({let _x = 9; $ex}))
|
macro_rules! bad_macro (($ex:expr) => ({let _x = 9; $ex}))
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _x = 8;
|
let _x = 8;
|
||||||
assert_eq!(bad_macro!(_x),8)
|
assert_eq!(bad_macro!(_x),8)
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ static magic: uint = 42;
|
|||||||
#[link_section="__DATA,__mut"]
|
#[link_section="__DATA,__mut"]
|
||||||
static mut frobulator: uint = 0xdeadbeef;
|
static mut frobulator: uint = 0xdeadbeef;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
frobulator = 0xcafebabe;
|
frobulator = 0xcafebabe;
|
||||||
printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);
|
printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);
|
||||||
|
@ -23,5 +23,5 @@ trait A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
}
|
}
|
||||||
|
@ -18,4 +18,4 @@ struct ヒ;
|
|||||||
|
|
||||||
static ラ: uint = 0;
|
static ラ: uint = 0;
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -14,4 +14,4 @@
|
|||||||
|
|
||||||
static mut bar: int = 2;
|
static mut bar: int = 2;
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
@ -16,7 +16,7 @@ mod bar {
|
|||||||
local_data_key!(pub baz: float)
|
local_data_key!(pub baz: float)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
local_data::get(foo, |x| assert!(x.is_none()));
|
local_data::get(foo, |x| assert!(x.is_none()));
|
||||||
local_data::get(bar::baz, |y| assert!(y.is_none()));
|
local_data::get(bar::baz, |y| assert!(y.is_none()));
|
||||||
|
|
||||||
|
@ -22,6 +22,6 @@ fn parse_args() -> ~str {
|
|||||||
return ~""
|
return ~""
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
io::println(parse_args());
|
io::println(parse_args());
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,6 @@ macro_rules! match_inside_expansion(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
assert_eq!(match_inside_expansion!(),129);
|
assert_eq!(match_inside_expansion!(),129);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ fn test5() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
test1();
|
test1();
|
||||||
test2();
|
test2();
|
||||||
test3();
|
test3();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
static s: int = 1;
|
static s: int = 1;
|
||||||
static e: int = 42;
|
static e: int = 42;
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
match 7 {
|
match 7 {
|
||||||
s..e => (),
|
s..e => (),
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Tests that matching rvalues with drops does not crash.
|
// Tests that matching rvalues with drops does not crash.
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
match ~[1, 2, 3] {
|
match ~[1, 2, 3] {
|
||||||
x => {
|
x => {
|
||||||
assert_eq!(x.len(), 3);
|
assert_eq!(x.len(), 3);
|
||||||
|
@ -26,7 +26,7 @@ impl Trait<int> for S2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let _ = S::<int>::new::<float>(1, 1.0);
|
let _ = S::<int>::new::<float>(1, 1.0);
|
||||||
let _: S2 = Trait::<int>::new::<float>(1, 1.0);
|
let _: S2 = Trait::<int>::new::<float>(1, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ fn to_str(sb: StringBuffer) -> ~str {
|
|||||||
sb.s
|
sb.s
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
let mut sb = StringBuffer {s: ~""};
|
let mut sb = StringBuffer {s: ~""};
|
||||||
sb.append("Hello, ");
|
sb.append("Hello, ");
|
||||||
sb.append("World!");
|
sb.append("World!");
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// Test that multibyte characters don't crash the compiler
|
// Test that multibyte characters don't crash the compiler
|
||||||
fn main() {
|
pub fn main() {
|
||||||
println("마이너스 사인이 없으면");
|
println("마이너스 사인이 없으면");
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,4 @@ impl Foo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
pub fn main() {}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user