From 6c03fbfefd950f5a5d54b3b86f84657f9908f5ff Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 23 May 2013 18:27:34 -0700 Subject: [PATCH 1/5] testsuite: Add passing test for #4735 --- src/test/run-pass/issue-4735.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/run-pass/issue-4735.rs diff --git a/src/test/run-pass/issue-4735.rs b/src/test/run-pass/issue-4735.rs new file mode 100644 index 0000000000000..aade0dcdc261c --- /dev/null +++ b/src/test/run-pass/issue-4735.rs @@ -0,0 +1,30 @@ +// 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. + + +use core::cast::transmute; +use core::libc::c_void; + +struct NonCopyable(*c_void); + +impl Drop for NonCopyable { + fn finalize(&self) { + let p = **self; + let v = unsafe { transmute::<*c_void, ~int>(p) }; + } +} + +fn main() { + let t = ~0; + let p = unsafe { transmute::<~int, *c_void>(t) }; + let z = NonCopyable(p); +} + + From 58547d64887184550b31efce1551818b1a1525fa Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 23 May 2013 18:36:22 -0700 Subject: [PATCH 2/5] testsuite: Add working test for #5550 --- src/test/run-pass/issue-5550.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/run-pass/issue-5550.rs diff --git a/src/test/run-pass/issue-5550.rs b/src/test/run-pass/issue-5550.rs new file mode 100644 index 0000000000000..54abc85053298 --- /dev/null +++ b/src/test/run-pass/issue-5550.rs @@ -0,0 +1,15 @@ +// 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. + +fn main() { + let s: ~str = ~"foobar"; + let mut t: &str = s; + t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe +} From 403aee10829c5c017352d7e4914a55c8a7a0efb6 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 23 May 2013 19:05:57 -0700 Subject: [PATCH 3/5] testsuite: Test cases, one xfailed, one not --- src/test/compile-fail/issue-5543.rs | 20 +++++++++++++++ src/test/run-pass/issue-5554.rs | 38 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/test/compile-fail/issue-5543.rs create mode 100644 src/test/run-pass/issue-5554.rs diff --git a/src/test/compile-fail/issue-5543.rs b/src/test/compile-fail/issue-5543.rs new file mode 100644 index 0000000000000..cad47eff01321 --- /dev/null +++ b/src/test/compile-fail/issue-5543.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. + +// xfail-test +use core::io::ReaderUtil; +use core::io::Reader; + +fn bar(r:@ReaderUtil) -> ~str { r.read_line() } + +fn main() { + let r : @Reader = io::stdin(); + let _m = bar(r as @ReaderUtil); +} diff --git a/src/test/run-pass/issue-5554.rs b/src/test/run-pass/issue-5554.rs new file mode 100644 index 0000000000000..6c0a3c37bc434 --- /dev/null +++ b/src/test/run-pass/issue-5554.rs @@ -0,0 +1,38 @@ +// 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. + +use core::num::Zero; + +pub struct X { + a: T +} + +// reordering these bounds stops the ICE +impl + Zero for X { + fn zero() -> X { + X { a: Zero::zero() } + } + fn is_zero(&self) -> bool { + self.a.is_zero() + } +} + +macro_rules! constants { + () => { + let _0 : X = Zero::zero(); + } +} + + +fn test_X() { + constants!(); +} + From 351f6033d644ece32bb3b4566e525ca647bd0e5c Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 27 May 2013 17:32:03 -0700 Subject: [PATCH 4/5] testsuite: Update core to std --- src/test/run-pass/issue-4735.rs | 4 ++-- src/test/run-pass/issue-5554.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/run-pass/issue-4735.rs b/src/test/run-pass/issue-4735.rs index aade0dcdc261c..e17fa21732924 100644 --- a/src/test/run-pass/issue-4735.rs +++ b/src/test/run-pass/issue-4735.rs @@ -9,8 +9,8 @@ // except according to those terms. -use core::cast::transmute; -use core::libc::c_void; +use std::cast::transmute; +use std::libc::c_void; struct NonCopyable(*c_void); diff --git a/src/test/run-pass/issue-5554.rs b/src/test/run-pass/issue-5554.rs index 6c0a3c37bc434..6ba36828cb1b0 100644 --- a/src/test/run-pass/issue-5554.rs +++ b/src/test/run-pass/issue-5554.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::num::Zero; +use std::num::Zero; pub struct X { a: T From 7ad1cc71e3f686fa47406abe0c07550945d2304f Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 28 May 2013 13:43:10 -0700 Subject: [PATCH 5/5] testsuite: Add main function to issue-5554 test --- src/test/run-pass/issue-5554.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/run-pass/issue-5554.rs b/src/test/run-pass/issue-5554.rs index 6ba36828cb1b0..9a0afc9d228fa 100644 --- a/src/test/run-pass/issue-5554.rs +++ b/src/test/run-pass/issue-5554.rs @@ -32,7 +32,6 @@ macro_rules! constants { } -fn test_X() { +pub fn main() { constants!(); } -