From 229ebf0bca23f5619940ecf2cf4541e0bb7416de Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 11:40:44 -0700 Subject: [PATCH 01/20] deleted two tests intended to test RUST_CC_ZEAL, an apparently defunct flag for the cycle collector --- src/test/run-pass/issue-1466.rs | 17 ----------------- src/test/run-pass/issue-1989.rs | 33 --------------------------------- 2 files changed, 50 deletions(-) delete mode 100644 src/test/run-pass/issue-1466.rs delete mode 100644 src/test/run-pass/issue-1989.rs 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]); -} From 5d8db6fd373f73e989439a4a95c6039ddc3fe1ed Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 12:25:44 -0700 Subject: [PATCH 02/20] remove (non-parsing) test related to impl d for d feature --- src/test/auxiliary/issue-2196-a.rs | 13 ------------- src/test/auxiliary/issue-2196-b.rs | 18 ------------------ src/test/auxiliary/issue-2196-c.rc | 16 ---------------- src/test/auxiliary/issue-2196-c.rs | 14 -------------- src/test/auxiliary/issue-2196-d.rs | 0 src/test/run-pass/issue-2196.rs | 19 ------------------- 6 files changed, 80 deletions(-) delete mode 100644 src/test/auxiliary/issue-2196-a.rs delete mode 100644 src/test/auxiliary/issue-2196-b.rs delete mode 100644 src/test/auxiliary/issue-2196-c.rc delete mode 100644 src/test/auxiliary/issue-2196-c.rs delete mode 100644 src/test/auxiliary/issue-2196-d.rs delete mode 100644 src/test/run-pass/issue-2196.rs 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-c.rs b/src/test/auxiliary/issue-2196-c.rs deleted file mode 100644 index 290267cbf3258..0000000000000 --- a/src/test/auxiliary/issue-2196-c.rs +++ /dev/null @@ -1,14 +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. - -use b::d; - -type t = uint; - 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/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() { } From 78942a2d16a9cb57f518ee6220b252e1e96e5881 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 13:22:59 -0700 Subject: [PATCH 03/20] this issue is a dup of another one that has a correct test case this test case has rotted wrt modern syntax. fortunately, this issue was a dup of another one, and that one still ICEs. --- src/test/run-pass/issue-2869.rs | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 src/test/run-pass/issue-2869.rs 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() {} From 77da0553455c5b236ea80056f743b26c7c0edbd3 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 13:44:49 -0700 Subject: [PATCH 04/20] This test case is obsolete for two reasons First, it refers to a feature (trait bounds on type parameters) that's apparently no longer in the language. Second, if I understand the issue correctly, it should never have been a "run-pass" test because it was supposed to fail. --- src/test/run-pass/issue-3480.rs | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 src/test/run-pass/issue-3480.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() {} From 9455eaf77bef8f225e146e61107d26010f137b51 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 13:58:15 -0700 Subject: [PATCH 05/20] changed to impl trait for type stx --- src/test/run-pass/issue-3979-generics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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}; From dd310d6c3b635628f584f3266b3ab31888fd0e95 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 14:48:59 -0700 Subject: [PATCH 06/20] Got test cases to pass, after some major surgery --- src/test/auxiliary/issue2378a.rs | 11 +++++++---- src/test/auxiliary/issue2378b.rs | 14 ++++++++------ src/test/run-pass/issue2378c.rs | 12 ++++++------ 3 files changed, 21 insertions(+), 16 deletions(-) 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/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)); } From 325263fe221647b7d6ef6c3cc1efd0d1e7cf3a21 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 15:05:39 -0700 Subject: [PATCH 07/20] this test still doesn't pass, but at least it parses... --- src/test/run-pass/mlist-cycle.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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()}; } From 7e89a514a5ce9aa427ca350a4ba62e63f3c89f95 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 15:13:24 -0700 Subject: [PATCH 08/20] This test case now parses I've done a slapdash job of fixing up the syntax; it didn't pass before, and it doesn't pass now, but at least it parses... --- src/test/run-pass/preempt.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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"); From add60bb081b9c23c8606a22b078f0885d5ab169c Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 15:20:36 -0700 Subject: [PATCH 09/20] Test now passes --- src/test/run-pass/regions-fn-subtyping-2.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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() { From cc4e0186ac005768ebede5b6b858b223c33e4de3 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 15:49:28 -0700 Subject: [PATCH 10/20] added test case for issue 5927 --- src/test/run-fail/issue-5927.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/run-fail/issue-5927.rs diff --git a/src/test/run-fail/issue-5927.rs b/src/test/run-fail/issue-5927.rs new file mode 100644 index 0000000000000..f302d706c15d7 --- /dev/null +++ b/src/test/run-fail/issue-5927.rs @@ -0,0 +1,20 @@ +// 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. +// +// 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. + + + +// error-pattern:cant-use-x-as-pattern-mumble + +fn main() { + let z = match 3 { + x() => x + }; + assert_eq!(z,3); +} From d6bb587c12da816b2872db1c1f9154a58fc91006 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 16:44:36 -0700 Subject: [PATCH 11/20] with syntax fixes, this test case now appears to pass --- src/test/run-pass/tag-align-dyn-u64.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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)); } From 178305ffecf4e183a425028ba53b39a4f4dd1121 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 16:48:33 -0700 Subject: [PATCH 12/20] fixed up issue-2185, but now it has a trait failure --- src/test/run-pass/issue-2185.rs | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index ac680d3d12e41..350dea4415dd0 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -8,22 +8,45 @@ // 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. + // 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)) { From 3a5361aec990ff2b07cabf9d9fbfac67f056d97f Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 30 Apr 2013 10:39:20 -0700 Subject: [PATCH 13/20] more commits on issue 2185 --- src/test/run-pass/issue-2185.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/run-pass/issue-2185.rs b/src/test/run-pass/issue-2185.rs index 350dea4415dd0..8a553784c5e2e 100644 --- a/src/test/run-pass/issue-2185.rs +++ b/src/test/run-pass/issue-2185.rs @@ -32,6 +32,7 @@ // 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 From 527f7716b76cf77f57915c663d88f72037e11af4 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 16:55:48 -0700 Subject: [PATCH 14/20] after syntax fixes, these tests appear to pass --- src/test/run-pass/tag-align-dyn-variants.rs | 64 ++++++++++----------- 1 file changed, 31 insertions(+), 33 deletions(-) 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)); } From 3931ce448e0329672583d3210df714cca5176f02 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 17:08:23 -0700 Subject: [PATCH 15/20] fixed the test case, hope it's still testing something --- src/test/run-pass/tag-align-shape.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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)}"); } From d1921fb3caa131c83673020a377e1d0cd245b1ea Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 17:10:26 -0700 Subject: [PATCH 16/20] fixed this test case too --- src/test/run-pass/tag-align-u64.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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)); } From 89bb02adf9f3ec55340b775a3b1f75c25478ce73 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 17:20:28 -0700 Subject: [PATCH 17/20] typestate is not planned for upcoming versions of rust.... --- src/test/run-pass/tstate-loop-break.rs | 27 -------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/test/run-pass/tstate-loop-break.rs 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(); -} From c75b7630bcc45bf9f2c7f6831e46c84b0c8f024f Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 30 Apr 2013 10:40:08 -0700 Subject: [PATCH 18/20] renamed issue-2185 to issue-3429 --- src/test/run-pass/{issue-1895.rs => issue-3429.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/test/run-pass/{issue-1895.rs => issue-3429.rs} (100%) 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 From fc661079a479f0aff6add4478c3afb8c2226b333 Mon Sep 17 00:00:00 2001 From: John Clements Date: Thu, 18 Apr 2013 17:28:22 -0700 Subject: [PATCH 19/20] fixed up syntax --- src/test/run-pass/type-sizes.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) 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::())); } From ab1d8ead91ac23e07f4ba9a186e0ae7ddbcd2515 Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 30 Apr 2013 11:58:55 -0700 Subject: [PATCH 20/20] fixed pattern, moved test to compile-fail --- src/test/{run-fail => compile-fail}/issue-5927.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/test/{run-fail => compile-fail}/issue-5927.rs (92%) diff --git a/src/test/run-fail/issue-5927.rs b/src/test/compile-fail/issue-5927.rs similarity index 92% rename from src/test/run-fail/issue-5927.rs rename to src/test/compile-fail/issue-5927.rs index f302d706c15d7..a1b4ee7aa3445 100644 --- a/src/test/run-fail/issue-5927.rs +++ b/src/test/compile-fail/issue-5927.rs @@ -10,7 +10,7 @@ -// error-pattern:cant-use-x-as-pattern-mumble +// error-pattern:unresolved enum variant fn main() { let z = match 3 {