about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-13 15:17:21 -0800
committerbors <bors@rust-lang.org>2014-02-13 15:17:21 -0800
commit94d453e459107ed1c5d76f693686b29d31cdc58c (patch)
treeb586a7c785fa57253b3ba1bcaaee5ae1ea167411 /src/test
parentcfb87f10ec7d41d0e7f8c68fbb908fc195517d41 (diff)
parent640b22852f59e4505cedfd02c01cc343d5ec0d9e (diff)
auto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton
This passed `make check` locally, so hopefully it passes on bors!
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/macro_crate_outlive_expansion_phase.rs35
-rw-r--r--src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs21
-rw-r--r--src/test/run-pass/colorful-write-macros.rs28
-rw-r--r--src/test/run-pass/issue-9918.rs13
4 files changed, 97 insertions, 0 deletions
diff --git a/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs b/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
new file mode 100644
index 00000000000..eecbb325630
--- /dev/null
+++ b/src/test/auxiliary/macro_crate_outlive_expansion_phase.rs
@@ -0,0 +1,35 @@
+// Copyright 2014 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// force-host
+
+#[feature(macro_registrar)];
+
+extern mod syntax;
+
+use std::any::Any;
+use std::local_data;
+use syntax::ast::Name;
+use syntax::ext::base::SyntaxExtension;
+
+struct Foo {
+    foo: int
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {}
+}
+
+#[macro_registrar]
+pub fn registrar(_: |Name, SyntaxExtension|) {
+    local_data_key!(foo: ~Any);
+    local_data::set(foo, ~Foo { foo: 10 } as ~Any);
+}
+
diff --git a/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
new file mode 100644
index 00000000000..a71cc465e88
--- /dev/null
+++ b/src/test/run-pass-fulldeps/macro-crate-outlive-expansion-phase.rs
@@ -0,0 +1,21 @@
+// Copyright 2014 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:macro_crate_outlive_expansion_phase.rs
+// ignore-stage1
+// ignore-fast
+// ignore-android
+
+#[feature(phase)];
+
+#[phase(syntax)]
+extern mod macro_crate_outlive_expansion_phase;
+
+pub fn main() {}
diff --git a/src/test/run-pass/colorful-write-macros.rs b/src/test/run-pass/colorful-write-macros.rs
new file mode 100644
index 00000000000..55bac0a0e07
--- /dev/null
+++ b/src/test/run-pass/colorful-write-macros.rs
@@ -0,0 +1,28 @@
+// Copyright 2014 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[allow(unused_must_use, dead_code)];
+
+use std::io::MemWriter;
+
+struct Foo<'a> {
+    writer: &'a mut Writer,
+    other: &'a str,
+}
+
+fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) {
+    write!(foo.writer, "{}", foo.other);
+}
+
+pub fn main() {
+    let mut w = MemWriter::new();
+    write!(&mut w as &mut Writer, "");
+    write!(&mut w, ""); // should coerce
+}
diff --git a/src/test/run-pass/issue-9918.rs b/src/test/run-pass/issue-9918.rs
new file mode 100644
index 00000000000..240a134221d
--- /dev/null
+++ b/src/test/run-pass/issue-9918.rs
@@ -0,0 +1,13 @@
+// Copyright 2014 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn main() {
+    assert_eq!((0 + 0u8) as char, '\0');
+}