about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-13 17:49:15 +0000
committerbors <bors@rust-lang.org>2015-03-13 17:49:15 +0000
commit9eb69abad8ffbce840e7dc7038ddea434dc987f1 (patch)
tree217b64e9e1271d2be83dfb091044432928861520 /src/test
parentee7696383f3423cdd17373ff9e75c01acd8e3417 (diff)
parent40b64645fecbee4e11da1ea4328c1b1ab4b9b8a0 (diff)
downloadrust-9eb69abad8ffbce840e7dc7038ddea434dc987f1.tar.gz
rust-9eb69abad8ffbce840e7dc7038ddea434dc987f1.zip
Auto merge of #23337 - Manishearth:rollup, r=Manishearth
r? @Manishearth
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/lint-dead-code-variant.rs42
-rw-r--r--src/test/debuginfo/gdb-pretty-std.rs60
-rw-r--r--src/test/run-make/rustdoc-default-impl/Makefile5
-rw-r--r--src/test/run-make/rustdoc-default-impl/bar.rs17
-rw-r--r--src/test/run-make/rustdoc-default-impl/foo.rs33
5 files changed, 157 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-dead-code-variant.rs b/src/test/compile-fail/lint-dead-code-variant.rs
new file mode 100644
index 00000000000..6146be65e38
--- /dev/null
+++ b/src/test/compile-fail/lint-dead-code-variant.rs
@@ -0,0 +1,42 @@
+// Copyright 2015 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.
+
+#![deny(dead_code)]
+
+#[derive(Copy)]
+enum Enum {
+    Variant1, //~ ERROR: variant is never used
+    Variant2,
+    Variant3,
+}
+
+fn copy(e: Enum) -> Enum {
+    use Enum::*;
+    match e {
+        Variant1 => Variant1,
+        Variant2 => Variant2,
+        Variant3 => Variant3,
+    }
+}
+
+fn max(e: Enum) -> Enum {
+    use Enum::*;
+    match e {
+        Variant1 => Variant3,
+        Variant2 => Variant3,
+        Variant3 => Variant3,
+    }
+}
+
+fn main() {
+    let e = Enum::Variant2;
+    copy(e);
+    max(e);
+}
diff --git a/src/test/debuginfo/gdb-pretty-std.rs b/src/test/debuginfo/gdb-pretty-std.rs
new file mode 100644
index 00000000000..dbf80a9bccc
--- /dev/null
+++ b/src/test/debuginfo/gdb-pretty-std.rs
@@ -0,0 +1,60 @@
+// Copyright 2013-2015 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.
+
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-tidy-linelength
+// ignore-lldb
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version 7.7
+
+// gdb-command: run
+
+// gdb-command: print slice
+// gdb-check:$1 = &[i32](len: 4) = {0, 1, 2, 3}
+
+// gdb-command: print vec
+// gdb-check:$2 = Vec<u64>(len: 4, cap: [...]) = {4, 5, 6, 7}
+
+// gdb-command: print str_slice
+// gdb-check:$3 = "IAMA string slice!"
+
+// gdb-command: print string
+// gdb-check:$4 = "IAMA string!"
+
+// gdb-command: print some
+// gdb-check:$5 = Some = {8}
+
+// gdb-command: print none
+// gdb-check:$6 = None
+
+fn main() {
+
+    // &[]
+    let slice: &[i32] = &[0, 1, 2, 3];
+
+    // Vec
+    let vec = vec![4u64, 5, 6, 7];
+
+    // &str
+    let str_slice = "IAMA string slice!";
+
+    // String
+    let string = "IAMA string!".to_string();
+
+    // Option
+    let some = Some(8i16);
+    let none: Option<i64> = None;
+
+    zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/run-make/rustdoc-default-impl/Makefile b/src/test/run-make/rustdoc-default-impl/Makefile
new file mode 100644
index 00000000000..338cf9d2053
--- /dev/null
+++ b/src/test/run-make/rustdoc-default-impl/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+
+all: foo.rs bar.rs
+	$(RUSTC) foo.rs --crate-type lib
+	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc bar.rs -L $(TMPDIR)
diff --git a/src/test/run-make/rustdoc-default-impl/bar.rs b/src/test/run-make/rustdoc-default-impl/bar.rs
new file mode 100644
index 00000000000..c9fae80d858
--- /dev/null
+++ b/src/test/run-make/rustdoc-default-impl/bar.rs
@@ -0,0 +1,17 @@
+// Copyright 2015 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.
+
+extern crate foo;
+
+pub use foo::bar;
+
+pub fn wut<T: bar::Bar>() {
+}
+
diff --git a/src/test/run-make/rustdoc-default-impl/foo.rs b/src/test/run-make/rustdoc-default-impl/foo.rs
new file mode 100644
index 00000000000..08f3bd10e74
--- /dev/null
+++ b/src/test/run-make/rustdoc-default-impl/foo.rs
@@ -0,0 +1,33 @@
+// Copyright 2015 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 mod bar {
+    use std::marker;
+
+    pub trait Bar: marker::MarkerTrait + 'static {}
+
+    impl Bar for .. {}
+
+    pub trait Foo {
+        fn foo(&self) {}
+    }
+
+    impl Foo {
+        pub fn test<T: Bar>(&self) {}
+    }
+
+    pub struct TypeId;
+
+    impl TypeId {
+        pub fn of<T: Bar + ?Sized>() -> TypeId {
+            panic!()
+        }
+    }
+}