From 1764e207fb2cec0c656e1acd0e07eefb9e6ac7b9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 15 Aug 2013 14:22:36 -0700 Subject: [PATCH] Add even more tests Closes #8248 Closes #8249 Closes #8398 Closes #8401 --- src/test/auxiliary/issue_8401.rs | 25 +++++++++++++++++++++++++ src/test/run-pass/issue-8248.rs | 21 +++++++++++++++++++++ src/test/run-pass/issue-8249.rs | 25 +++++++++++++++++++++++++ src/test/run-pass/issue-8398.rs | 18 ++++++++++++++++++ src/test/run-pass/issue-8401.rs | 16 ++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 src/test/auxiliary/issue_8401.rs create mode 100644 src/test/run-pass/issue-8248.rs create mode 100644 src/test/run-pass/issue-8249.rs create mode 100644 src/test/run-pass/issue-8398.rs create mode 100644 src/test/run-pass/issue-8401.rs diff --git a/src/test/auxiliary/issue_8401.rs b/src/test/auxiliary/issue_8401.rs new file mode 100644 index 00000000000..9e4d90e979d --- /dev/null +++ b/src/test/auxiliary/issue_8401.rs @@ -0,0 +1,25 @@ +// 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. + +// for this issue, this code must be built in a library + +use std::cast; + +trait A {} +struct B; +impl A for B {} + +fn bar(_: &mut A, _: &T) {} + +fn foo(t: &T) { + let b = B; + bar(unsafe { cast::transmute(&b as &A) }, t) +} + diff --git a/src/test/run-pass/issue-8248.rs b/src/test/run-pass/issue-8248.rs new file mode 100644 index 00000000000..48f34805fee --- /dev/null +++ b/src/test/run-pass/issue-8248.rs @@ -0,0 +1,21 @@ +// 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. + +trait A {} +struct B; +impl A for B {} + +fn foo(_: &mut A) {} + +fn main() { + let mut b = B; + foo(&mut b as &mut A); +} + diff --git a/src/test/run-pass/issue-8249.rs b/src/test/run-pass/issue-8249.rs new file mode 100644 index 00000000000..ad37196dce4 --- /dev/null +++ b/src/test/run-pass/issue-8249.rs @@ -0,0 +1,25 @@ +// 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. + +trait A {} +struct B; +impl A for B {} + +struct C<'self> { + foo: &'self mut A, +} + +fn foo(a: &mut A) { + C{ foo: a }; +} + +fn main() { +} + diff --git a/src/test/run-pass/issue-8398.rs b/src/test/run-pass/issue-8398.rs new file mode 100644 index 00000000000..5e04c96af72 --- /dev/null +++ b/src/test/run-pass/issue-8398.rs @@ -0,0 +1,18 @@ +// 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 std::rt::io; + +fn foo(a: &mut io::Writer) { + a.write([]) +} + +fn main(){} + diff --git a/src/test/run-pass/issue-8401.rs b/src/test/run-pass/issue-8401.rs new file mode 100644 index 00000000000..cf786835107 --- /dev/null +++ b/src/test/run-pass/issue-8401.rs @@ -0,0 +1,16 @@ +// 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. + +// aux-build:issue_8401.rs +// xfail-fast + +extern mod issue_8401; + +pub fn main() {}