about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-03 14:21:37 +0000
committerbors <bors@rust-lang.org>2017-08-03 14:21:37 +0000
commit8cb4b2c589f3886934bc1ebc6cba3ffff9c87f44 (patch)
treef6b251bceadbbe9c8f94f61f282c153aff5746b9 /src
parentb8499e0460e36dfb304b8800c83587b2cacc887c (diff)
parenta704511f9d10804bea55e0d4d7eeb4cab6c413fc (diff)
Auto merge of #43609 - dsprenkels:issue-40510, r=Mark-Simulacrum
Add regression test for #40510

This pull request adds a test case for issue #40510.

Fixes #40510.
Diffstat (limited to 'src')
-rw-r--r--src/test/compile-fail/issue-40510-1.rs23
-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, 96 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-40510-1.rs b/src/test/compile-fail/issue-40510-1.rs
new file mode 100644
index 00000000000..142092ff41e
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-1.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 mut x: Box<()> = Box::new(());
+
+    || {
+        &mut x
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
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