about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaan Sprenkels <hello@dsprenkels.com>2017-08-03 04:14:16 +0200
committerDaan Sprenkels <hello@dsprenkels.com>2017-08-03 13:14:47 +0700
commita704511f9d10804bea55e0d4d7eeb4cab6c413fc (patch)
tree57a8ce4d103b6fd851dcb0b362d282068dba8733
parent92836e397c5935c7cd8a7529de03bc5649931fa9 (diff)
Add more regression tests for #40510
-rw-r--r--src/test/compile-fail/issue-40510-1.rs (renamed from src/test/compile-fail/issue-40510.rs)0
-rw-r--r--src/test/compile-fail/issue-40510-2.rs23
-rw-r--r--src/test/compile-fail/issue-40510-3.rs25
-rw-r--r--src/test/compile-fail/issue-40510-4.rs25
4 files changed, 73 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-40510.rs b/src/test/compile-fail/issue-40510-1.rs
index 142092ff41e..142092ff41e 100644
--- a/src/test/compile-fail/issue-40510.rs
+++ b/src/test/compile-fail/issue-40510-1.rs
diff --git a/src/test/compile-fail/issue-40510-2.rs b/src/test/compile-fail/issue-40510-2.rs
new file mode 100644
index 00000000000..0fe56584822
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-2.rs
@@ -0,0 +1,23 @@
+// Copyright 2017 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let x: Box<()> = Box::new(());
+
+    || {
+        &x
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-40510-3.rs b/src/test/compile-fail/issue-40510-3.rs
new file mode 100644
index 00000000000..afa8f15ee57
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-3.rs
@@ -0,0 +1,25 @@
+// Copyright 2017 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let mut x: Vec<()> = Vec::new();
+
+    || {
+        || {
+            x.push(())
+        }
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-40510-4.rs b/src/test/compile-fail/issue-40510-4.rs
new file mode 100644
index 00000000000..a39c500225b
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-4.rs
@@ -0,0 +1,25 @@
+// Copyright 2017 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let x: Vec<()> = Vec::new();
+
+    || {
+        || {
+            x.len()
+        }
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful