about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuke Gallagher <luke@hypergeometric.net>2015-04-10 16:12:54 +1000
committerLuke Gallagher <luke@hypergeometric.net>2015-04-10 16:12:54 +1000
commit2a88b7922396a010e31c99a73a2fead306840248 (patch)
tree8730ebde75e2cd8b60e98a913f65ff0b7d13b9e9
parent6b95d8bed8afff7262ec5623677e320bf63d2230 (diff)
downloadrust-2a88b7922396a010e31c99a73a2fead306840248.tar.gz
rust-2a88b7922396a010e31c99a73a2fead306840248.zip
Add tests for E-needstest issues
Closes #20772
Closes #20939
Closes #21950
Closes #22034
-rw-r--r--src/test/compile-fail/issue-20772.rs15
-rw-r--r--src/test/compile-fail/issue-20939.rs16
-rw-r--r--src/test/compile-fail/issue-21950.rs20
-rw-r--r--src/test/compile-fail/issue-22034.rs19
4 files changed, 70 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-20772.rs b/src/test/compile-fail/issue-20772.rs
new file mode 100644
index 00000000000..44c92f946f0
--- /dev/null
+++ b/src/test/compile-fail/issue-20772.rs
@@ -0,0 +1,15 @@
+// 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.
+
+trait T : Iterator<Item=Self::Item>
+//~^ ERROR unsupported cyclic reference between types/traits detected
+{}
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-20939.rs b/src/test/compile-fail/issue-20939.rs
new file mode 100644
index 00000000000..88197166ee0
--- /dev/null
+++ b/src/test/compile-fail/issue-20939.rs
@@ -0,0 +1,16 @@
+// 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.
+
+trait Foo {}
+
+impl<'a> Foo for Foo+'a {}
+//~^ ERROR the object type `Foo + 'a` automatically implements the trait `Foo`
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-21950.rs b/src/test/compile-fail/issue-21950.rs
new file mode 100644
index 00000000000..315a4cd90c5
--- /dev/null
+++ b/src/test/compile-fail/issue-21950.rs
@@ -0,0 +1,20 @@
+// 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.
+
+// ignore-tidy-linelength
+
+use std::ops::Add;
+
+fn main() {
+    let x = &10 as
+            //~^ ERROR the value of the associated type `Output` (from the trait `core::ops::Add`) must be specified
+            &Add;
+            //~^ ERROR the type parameter `RHS` must be explicitly specified in an object type because its default value `Self` references the type `Self`
+}
diff --git a/src/test/compile-fail/issue-22034.rs b/src/test/compile-fail/issue-22034.rs
new file mode 100644
index 00000000000..004e33b76a9
--- /dev/null
+++ b/src/test/compile-fail/issue-22034.rs
@@ -0,0 +1,19 @@
+// 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 libc;
+
+fn main() {
+    let foo: *mut libc::c_void;
+    let cb: &mut Fn() = unsafe {
+        &mut *(foo as *mut Fn())
+        //~^ ERROR use of possibly uninitialized variable: `foo`
+    };
+}