diff --git a/src/test/auxiliary/issue-2196-a.rs b/src/test/auxiliary/issue-2196-a.rs deleted file mode 100644 index 959164d85dd2f..0000000000000 --- a/src/test/auxiliary/issue-2196-a.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[link(name = "issue2196a", vers = "0.1")]; -#[crate_type = "lib"]; - diff --git a/src/test/auxiliary/issue-2196-b.rs b/src/test/auxiliary/issue-2196-b.rs deleted file mode 100644 index 1ef9334b7cdf3..0000000000000 --- a/src/test/auxiliary/issue-2196-b.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[link(name = "issue2196b", vers = "0.1")]; -#[crate_type = "lib"]; - -use a(name = "issue2196a"); - -type d = str; -impl d for d { } - diff --git a/src/test/auxiliary/issue-2196-c.rc b/src/test/auxiliary/issue-2196-c.rc deleted file mode 100644 index 59c1e8108c08c..0000000000000 --- a/src/test/auxiliary/issue-2196-c.rc +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[link(name = "issue2196c", vers = "0.1")]; -#[crate_type = "lib"]; - -use b(name = "issue2196b"); -#[path = "issue-2196-d.rs"] -mod d; diff --git a/src/test/auxiliary/issue-2196-d.rs b/src/test/auxiliary/issue-2196-d.rs deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/src/test/auxiliary/issue2378a.rs b/src/test/auxiliary/issue2378a.rs index ead338c4bc803..1873aca5909ca 100644 --- a/src/test/auxiliary/issue2378a.rs +++ b/src/test/auxiliary/issue2378a.rs @@ -8,13 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[link (name = "issue2378a")]; +#[crate_type = "lib"]; + enum maybe { just(T), nothing } -impl copy> for maybe for methods T { +impl Index for maybe { + fn index(&self, idx: &uint) -> T { match self { - just(t) { t } - nothing { fail!(); } + &just(ref t) => copy *t, + ¬hing => { fail!(); } } } } diff --git a/src/test/auxiliary/issue2378b.rs b/src/test/auxiliary/issue2378b.rs index 9037417ef6224..20f07a5cb546b 100644 --- a/src/test/auxiliary/issue2378b.rs +++ b/src/test/auxiliary/issue2378b.rs @@ -8,15 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use issue2378a; +#[link (name = "issue2378b")]; +#[crate_type = "lib"]; + +extern mod issue2378a; use issue2378a::maybe; -use issue2378a::methods; -type two_maybes = {a: maybe, b: maybe}; +struct two_maybes {a: maybe, b: maybe} -impl copy> for two_maybes for methods (T, T) { - (self.a[idx], self.b[idx]) +impl Index for two_maybes { + fn index(&self, idx: &uint) -> (T, T) { + (self.a[*idx], self.b[*idx]) } } diff --git a/src/test/auxiliary/issue-2196-c.rs b/src/test/compile-fail/issue-5927.rs similarity index 68% rename from src/test/auxiliary/issue-2196-c.rs rename to src/test/compile-fail/issue-5927.rs index 290267cbf3258..a1b4ee7aa3445 100644 --- a/src/test/auxiliary/issue-2196-c.rs +++ b/src/test/compile-fail/issue-5927.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,7 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use b::d; -type t = uint; +// error-pattern:unresolved enum variant + +fn main() { + let z = match 3 { + x() => x + }; + assert_eq!(z,3); +} diff --git a/src/test/run-pass/issue-1466.rs b/src/test/run-pass/issue-1466.rs deleted file mode 100644 index 1915f1b3a4100..0000000000000 --- a/src/test/run-pass/issue-1466.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_CC_ZEAL=1 -// xfail-test - -pub fn main() { - error!("%?", os::getenv(~"RUST_CC_ZEAL")); - let _x = @{a: @10, b: ~true}; -} diff --git a/src/test/run-pass/issue-1989.rs b/src/test/run-pass/issue-1989.rs deleted file mode 100644 index e3327283a8162..0000000000000 --- a/src/test/run-pass/issue-1989.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// exec-env:RUST_CC_ZEAL=1 - -enum maybe_pointy { - none, - p(@mut Pointy) -} - -struct Pointy { - a : maybe_pointy, - f : @fn()->(), -} - -fn empty_pointy() -> @mut Pointy { - return @mut Pointy{ - a : none, - f : || {}, - } -} - -pub fn main() { - let v = ~[empty_pointy(), empty_pointy()]; - v[0].a = p(v[0]); -} diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index ac680d3d12e41..8a553784c5e2e 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -8,22 +8,46 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test FIXME #2263 +// does the second one subsume the first? +// xfail-test // xfail-fast + +// notes on this test case: +// On Thu, Apr 18, 2013 at 6:30 PM, John Clements wrote: +// the "issue-2185.rs" test was xfailed with a ref to #2263. Issue #2263 is now fixed, so I tried it again, and after adding some &self parameters, I got this error: +// +// Running /usr/local/bin/rustc: +// issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait +// issue-2185.rs:24 impl iterable for @fn(&fn(uint)) { +// issue-2185.rs:25 fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) } +// issue-2185.rs:26 } +// issue-2185.rs:20:0: 22:1 note: note conflicting implementation here +// issue-2185.rs:20 impl iterable for @fn(&fn(A)) { +// issue-2185.rs:21 fn iter(&self, blk: &fn(A)) { self(blk); } +// issue-2185.rs:22 } +// +// … so it looks like it's just not possible to implement both the generic iterable and iterable for the type iterable. Is it okay if I just remove this test? +// +// but Niko responded: +// think it's fine to remove this test, just because it's old and cruft and not hard to reproduce. *However* it should eventually be possible to implement the same interface for the same type multiple times with different type parameters, it's just that our current trait implementation has accidental limitations. + +// so I'm leaving it in. +// actually, it looks like this is related to bug #3429. I'll rename this bug. + // This test had to do with an outdated version of the iterable trait. // However, the condition it was testing seemed complex enough to // warrant still having a test, so I inlined the old definitions. trait iterable { - fn iter(blk: &fn(A)); + fn iter(&self, blk: &fn(A)); } impl iterable for @fn(&fn(A)) { - fn iter(blk: &fn(A)) { self(blk); } + fn iter(&self, blk: &fn(A)) { self(blk); } } impl iterable for @fn(&fn(uint)) { - fn iter(blk: &fn(&&v: uint)) { self( |i| blk(i) ) } + fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) } } fn filter>(self: IA, prd: @fn(A) -> bool, blk: &fn(A)) { diff --git a/src/test/run-pass/issue-2196.rs b/src/test/run-pass/issue-2196.rs deleted file mode 100644 index 3fce821561a90..0000000000000 --- a/src/test/run-pass/issue-2196.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// xfail-test -// aux-build:issue-2196-a.rs -// aux-build:issue-2196-b.rs -// aux-build:issue-2196-c.rc - -use c(name = "issue2196c"); -use c::t; - -pub fn main() { } diff --git a/src/test/run-pass/issue-2869.rs b/src/test/run-pass/issue-2869.rs deleted file mode 100644 index 619f4b4d7db8a..0000000000000 --- a/src/test/run-pass/issue-2869.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// xfail-test -enum pat { pat_ident(Option) } - -fn f(pat: pat) -> bool { true } - -fn num_bindings(pat: pat) -> uint { - match pat { - pat_ident(_) if f(pat) { 0 } - pat_ident(None) { 1 } - pat_ident(Some(sub)) { sub } - } -} - -pub fn main() {} diff --git a/src/test/run-pass/issue-1895.rs b/src/test/run-pass/issue-3429.rs similarity index 100% rename from src/test/run-pass/issue-1895.rs rename to src/test/run-pass/issue-3429.rs diff --git a/src/test/run-pass/issue-3480.rs b/src/test/run-pass/issue-3480.rs deleted file mode 100644 index aaff822398d6f..0000000000000 --- a/src/test/run-pass/issue-3480.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// xfail-test -type IMap = ~[(K, V)]; - -trait ImmutableMap -{ - fn contains_key(key: K) -> bool; -} - -impl IMap : ImmutableMap -{ - fn contains_key(key: K) -> bool { - vec::find(self, |e| {e.first() == key}).is_some() - } -} - -pub fn main() {} diff --git a/src/test/run-pass/issue-3979-generics.rs b/src/test/run-pass/issue-3979-generics.rs index d26e9f1ba7b43..57962911538de 100644 --- a/src/test/run-pass/issue-3979-generics.rs +++ b/src/test/run-pass/issue-3979-generics.rs @@ -32,7 +32,7 @@ impl Positioned for Point { } } -impl Point: Movable; +impl Movable for Point; pub fn main() { let p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/issue2378c.rs b/src/test/run-pass/issue2378c.rs index ea8c47a3eb91a..98e60c56476d8 100644 --- a/src/test/run-pass/issue2378c.rs +++ b/src/test/run-pass/issue2378c.rs @@ -8,17 +8,17 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -- #2378 unfixed // aux-build:issue2378a.rs // aux-build:issue2378b.rs +// xfail-fast - check-fast doesn't understand aux-build -use issue2378a; -use issue2378b; +extern mod issue2378a; +extern mod issue2378b; -use issue2378a::{just, methods}; -use issue2378b::{methods}; +use issue2378a::{just}; +use issue2378b::{two_maybes}; pub fn main() { - let x = {a: just(3), b: just(5)}; + let x = two_maybes{a: just(3), b: just(5)}; assert!(x[0u] == (3, 5)); } diff --git a/src/test/run-pass/mlist-cycle.rs b/src/test/run-pass/mlist-cycle.rs index e886c941a4b6a..a67f1574f64af 100644 --- a/src/test/run-pass/mlist-cycle.rs +++ b/src/test/run-pass/mlist-cycle.rs @@ -10,16 +10,18 @@ // xfail-test // -*- rust -*- -extern mod std; +extern mod core; +use core::gc; +use core::gc::rustrt; -type cell = {c: @list}; +struct cell {c: @list} enum list { link(@mut cell), nil, } pub fn main() { - let first: @cell = @mut {c: @nil()}; - let second: @cell = @mut {c: @link(first)}; + let first: @cell = @mut cell{c: @nil()}; + let second: @cell = @mut cell{c: @link(first)}; first._0 = @link(second); - sys.rustrt.gc(); - let third: @cell = @mut {c: @nil()}; + rustrt::gc(); + let third: @cell = @mut cell{c: @nil()}; } diff --git a/src/test/run-pass/preempt.rs b/src/test/run-pass/preempt.rs index e0434c14048a0..3d3e178f064ae 100644 --- a/src/test/run-pass/preempt.rs +++ b/src/test/run-pass/preempt.rs @@ -13,7 +13,7 @@ fn starve_main(alive: chan) { debug!("signalling main"); - alive <| 1; + alive.recv(1); debug!("starving main"); let i: int = 0; loop { i += 1; } @@ -22,10 +22,12 @@ fn starve_main(alive: chan) { pub fn main() { let alive: port = port(); debug!("main started"); - let s: task = spawn starve_main(chan(alive)); + let s: task = do task::spawn { + starve_main(chan(alive)); + }; let i: int; debug!("main waiting for alive signal"); - alive |> i; + alive.send(i); debug!("main got alive signal"); while i < 50 { debug!("main iterated"); i += 1; } debug!("main completed"); diff --git a/src/test/run-pass/regions-fn-subtyping-2.rs b/src/test/run-pass/regions-fn-subtyping-2.rs index a995b3d969352..a660b9c9ee2d5 100644 --- a/src/test/run-pass/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions-fn-subtyping-2.rs @@ -8,20 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test - // Issue #2263. // Here, `f` is a function that takes a pointer `x` and a function // `g`, where `g` requires its argument `y` to be in the same region // that `x` is in. -fn has_same_region(f: &fn(x: &a.int, g: &fn(y: &a.int))) { +fn has_same_region(f: &fn<'a>(x: &'a int, g: &fn(y: &'a int))) { // `f` should be the type that `wants_same_region` wants, but // right now the compiler complains that it isn't. wants_same_region(f); } -fn wants_same_region(_f: &fn(x: &b.int, g: &fn(y: &b.int))) { +fn wants_same_region(_f: &fn<'b>(x: &'b int, g: &fn(y: &'b int))) { } pub fn main() { diff --git a/src/test/run-pass/tag-align-dyn-u64.rs b/src/test/run-pass/tag-align-dyn-u64.rs index a9c59de49eeaa..0fdf4e019a775 100644 --- a/src/test/run-pass/tag-align-dyn-u64.rs +++ b/src/test/run-pass/tag-align-dyn-u64.rs @@ -8,27 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test - -tag a_tag { - a_tag(A); +enum a_tag { + a_tag(A) } -type t_rec = { +struct t_rec { c8: u8, t: a_tag -}; +} fn mk_rec() -> t_rec { - return { c8:0u8, t:a_tag(0u64) }; + return t_rec { c8:0u8, t:a_tag(0u64) }; } -fn is_8_byte_aligned(&&u: a_tag) -> bool { +fn is_8_byte_aligned(u: &a_tag) -> bool { let p = ptr::to_unsafe_ptr(u) as uint; return (p & 7u) == 0u; } pub fn main() { let x = mk_rec(); - assert!(is_8_byte_aligned(x.t)); + assert!(is_8_byte_aligned(&x.t)); } diff --git a/src/test/run-pass/tag-align-dyn-variants.rs b/src/test/run-pass/tag-align-dyn-variants.rs index 4fc6410f8f3d0..96921f2a065c2 100644 --- a/src/test/run-pass/tag-align-dyn-variants.rs +++ b/src/test/run-pass/tag-align-dyn-variants.rs @@ -8,64 +8,62 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test - -tag a_tag { - varA(A); - varB(B); +enum a_tag { + varA(A), + varB(B) } -type t_rec = { +struct t_rec { chA: u8, tA: a_tag, chB: u8, tB: a_tag -}; +} -fn mk_rec(a: A, b: B) -> t_rec { - return { chA:0u8, tA:varA(a), chB:1u8, tB:varB(b) }; +fn mk_rec(a: A, b: B) -> t_rec { + return t_rec{ chA:0u8, tA:varA(a), chB:1u8, tB:varB(b) }; } -fn is_aligned(amnt: uint, &&u: A) -> bool { +fn is_aligned(amnt: uint, u: &A) -> bool { let p = ptr::to_unsafe_ptr(u) as uint; return (p & (amnt-1u)) == 0u; } -fn variant_data_is_aligned(amnt: uint, &&u: a_tag) -> bool { +fn variant_data_is_aligned(amnt: uint, u: &a_tag) -> bool { match u { - varA(a) { is_aligned(amnt, a) } - varB(b) { is_aligned(amnt, b) } + &varA(ref a) => is_aligned(amnt, a), + &varB(ref b) => is_aligned(amnt, b) } } pub fn main() { let x = mk_rec(22u64, 23u64); - assert!(is_aligned(8u, x.tA)); - assert!(variant_data_is_aligned(8u, x.tA)); - assert!(is_aligned(8u, x.tB)); - assert!(variant_data_is_aligned(8u, x.tB)); + assert!(is_aligned(8u, &x.tA)); + assert!(variant_data_is_aligned(8u, &x.tA)); + assert!(is_aligned(8u, &x.tB)); + assert!(variant_data_is_aligned(8u, &x.tB)); let x = mk_rec(22u64, 23u32); - assert!(is_aligned(8u, x.tA)); - assert!(variant_data_is_aligned(8u, x.tA)); - assert!(is_aligned(8u, x.tB)); - assert!(variant_data_is_aligned(4u, x.tB)); + assert!(is_aligned(8u, &x.tA)); + assert!(variant_data_is_aligned(8u, &x.tA)); + assert!(is_aligned(8u, &x.tB)); + assert!(variant_data_is_aligned(4u, &x.tB)); let x = mk_rec(22u32, 23u64); - assert!(is_aligned(8u, x.tA)); - assert!(variant_data_is_aligned(4u, x.tA)); - assert!(is_aligned(8u, x.tB)); - assert!(variant_data_is_aligned(8u, x.tB)); + assert!(is_aligned(8u, &x.tA)); + assert!(variant_data_is_aligned(4u, &x.tA)); + assert!(is_aligned(8u, &x.tB)); + assert!(variant_data_is_aligned(8u, &x.tB)); let x = mk_rec(22u32, 23u32); - assert!(is_aligned(4u, x.tA)); - assert!(variant_data_is_aligned(4u, x.tA)); - assert!(is_aligned(4u, x.tB)); - assert!(variant_data_is_aligned(4u, x.tB)); + assert!(is_aligned(4u, &x.tA)); + assert!(variant_data_is_aligned(4u, &x.tA)); + assert!(is_aligned(4u, &x.tB)); + assert!(variant_data_is_aligned(4u, &x.tB)); let x = mk_rec(22f64, 23f64); - assert!(is_aligned(8u, x.tA)); - assert!(variant_data_is_aligned(8u, x.tA)); - assert!(is_aligned(8u, x.tB)); - assert!(variant_data_is_aligned(8u, x.tB)); + assert!(is_aligned(8u, &x.tA)); + assert!(variant_data_is_aligned(8u, &x.tA)); + assert!(is_aligned(8u, &x.tB)); + assert!(variant_data_is_aligned(8u, &x.tB)); } diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index 052bacad7ce19..43a793a34c89d 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -8,22 +8,18 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -// -// See issue #1535 - -tag a_tag { - a_tag(u64); +enum a_tag { + a_tag(u64) } -type t_rec = { +struct t_rec { c8: u8, t: a_tag -}; +} pub fn main() { - let x = {c8: 22u8, t: a_tag(44u64)}; + let x = t_rec {c8: 22u8, t: a_tag(44u64)}; let y = fmt!("%?", x); debug!("y = %s", y); - assert!(y == "(22, a_tag(44))"); + assert_eq!(y, ~"{c8: 22, t: a_tag(44)}"); } diff --git a/src/test/run-pass/tag-align-u64.rs b/src/test/run-pass/tag-align-u64.rs index fd96d7d0242c3..56d384e5fdb76 100644 --- a/src/test/run-pass/tag-align-u64.rs +++ b/src/test/run-pass/tag-align-u64.rs @@ -8,27 +8,26 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -tag a_tag { - a_tag(u64); +enum a_tag { + a_tag(u64) } -type t_rec = { +struct t_rec { c8: u8, t: a_tag -}; +} fn mk_rec() -> t_rec { - return { c8:0u8, t:a_tag(0u64) }; + return t_rec { c8:0u8, t:a_tag(0u64) }; } -fn is_8_byte_aligned(&&u: a_tag) -> bool { +fn is_8_byte_aligned(u: &a_tag) -> bool { let p = ptr::to_unsafe_ptr(u) as u64; return (p & 7u64) == 0u64; } pub fn main() { let x = mk_rec(); - assert!(is_8_byte_aligned(x.t)); + assert!(is_8_byte_aligned(&x.t)); } diff --git a/src/test/run-pass/tstate-loop-break.rs b/src/test/run-pass/tstate-loop-break.rs deleted file mode 100644 index 4228f72b7caa4..0000000000000 --- a/src/test/run-pass/tstate-loop-break.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// xfail-test - -fn is_even(i: int) -> bool { (i%2) == 0 } -fn even(i: int) : is_even(i) -> int { i } - -fn test() { - let v = 4; - loop { - check is_even(v); - break; - } - even(v); -} - -pub fn main() { - test(); -} diff --git a/src/test/run-pass/type-sizes.rs b/src/test/run-pass/type-sizes.rs index bc2ca20d642d9..134f1e4098f07 100644 --- a/src/test/run-pass/type-sizes.rs +++ b/src/test/run-pass/type-sizes.rs @@ -8,9 +8,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// xfail-test -use sys::rustrt::size_of; -extern mod std; +extern mod core; +use core::sys::size_of; + +struct t {a: u8, b: i8} +struct u {a: u8, b: i8, c: u8} +struct v {a: u8, b: i8, c: v2, d: u32} +struct v2 {u: char, v: u8} +struct w {a: int, b: ()} +struct x {a: int, b: (), c: ()} +struct y {x: int} pub fn main() { assert!((size_of::() == 1 as uint)); @@ -18,14 +25,14 @@ pub fn main() { assert!((size_of::() == 4 as uint)); assert!((size_of::() == 1 as uint)); assert!((size_of::() == 4 as uint)); - assert!((size_of::<{a: u8, b: i8}>() == 2 as uint)); - assert!((size_of::<{a: u8, b: i8, c: u8}>() == 3 as uint)); + assert!((size_of::() == 2 as uint)); + assert!((size_of::() == 3 as uint)); // Alignment causes padding before the char and the u32. - assert!(size_of::<{a: u8, b: i8, c: {u: char, v: u8}, d: u32}>() == + assert!(size_of::() == 16 as uint); assert!((size_of::() == size_of::())); - assert!((size_of::<{a: int, b: ()}>() == size_of::())); - assert!((size_of::<{a: int, b: (), c: ()}>() == size_of::())); - assert!((size_of::() == size_of::<{x: int}>())); + assert!((size_of::() == size_of::())); + assert!((size_of::() == size_of::())); + assert!((size_of::() == size_of::())); }