about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-05-26 10:20:28 -0400
committerGitHub <noreply@github.com>2017-05-26 10:20:28 -0400
commit2c3aa9154d5abb7a2db15c878de2b07468bcf2af (patch)
tree178228707bc49149cb8399ea97df7ce379b8e015 /src
parent2451f65c5cb446e713745ac43b8192c063763ca1 (diff)
parent2160b4ae589eeedbc8411f5bf2b02774194ce8e3 (diff)
downloadrust-2c3aa9154d5abb7a2db15c878de2b07468bcf2af.tar.gz
rust-2c3aa9154d5abb7a2db15c878de2b07468bcf2af.zip
Rollup merge of #42230 - venkatagiri:ice_regression_tests, r=Mark-Simulacrum
regression tests for ICEs

closes #36379
closes #37550
closes #37665
closes #38160
closes #38954
closes #39362

r? @Mark-Simulacrum
Diffstat (limited to 'src')
-rw-r--r--src/test/compile-fail/issue-36379.rs16
-rw-r--r--src/test/compile-fail/issue-37550.rs18
-rw-r--r--src/test/compile-fail/issue-37665.rs20
-rw-r--r--src/test/compile-fail/issue-38160.rs31
-rw-r--r--src/test/compile-fail/issue-38954.rs16
-rw-r--r--src/test/compile-fail/issue-39362.rs28
6 files changed, 129 insertions, 0 deletions
diff --git a/src/test/compile-fail/issue-36379.rs b/src/test/compile-fail/issue-36379.rs
new file mode 100644
index 00000000000..2f513b034c3
--- /dev/null
+++ b/src/test/compile-fail/issue-36379.rs
@@ -0,0 +1,16 @@
+// 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(conservative_impl_trait, rustc_attrs)]
+
+fn _test() -> impl Default { }
+
+#[rustc_error]
+fn main() { } //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-37550.rs b/src/test/compile-fail/issue-37550.rs
new file mode 100644
index 00000000000..e1f7f64e01a
--- /dev/null
+++ b/src/test/compile-fail/issue-37550.rs
@@ -0,0 +1,18 @@
+// 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(const_fn)]
+
+const fn x() {
+    let t = true; //~ ERROR blocks in constant functions are limited to items and tail expressions
+    let x = || t; //~ ERROR blocks in constant functions are limited to items and tail expressions
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/issue-37665.rs b/src/test/compile-fail/issue-37665.rs
new file mode 100644
index 00000000000..f86f570d25d
--- /dev/null
+++ b/src/test/compile-fail/issue-37665.rs
@@ -0,0 +1,20 @@
+// 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.
+
+// compile-flags: -Z unstable-options --unpretty=mir
+
+use std::path::MAIN_SEPARATOR;
+
+fn main() {
+    let mut foo : String = "hello".to_string();
+    foo.push(MAIN_SEPARATOR);
+    println!("{}", foo);
+    let x: () = 0; //~ ERROR: mismatched types
+}
diff --git a/src/test/compile-fail/issue-38160.rs b/src/test/compile-fail/issue-38160.rs
new file mode 100644
index 00000000000..311d0ceb4d3
--- /dev/null
+++ b/src/test/compile-fail/issue-38160.rs
@@ -0,0 +1,31 @@
+// 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(associated_consts, rustc_attrs)]
+#![allow(warnings)]
+
+trait MyTrait {
+    const MY_CONST: &'static str;
+}
+
+macro_rules! my_macro {
+    () => {
+        struct MyStruct;
+
+        impl MyTrait for MyStruct {
+            const MY_CONST: &'static str = stringify!(abc);
+        }
+    }
+}
+
+my_macro!();
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-38954.rs b/src/test/compile-fail/issue-38954.rs
new file mode 100644
index 00000000000..65b17a3db0b
--- /dev/null
+++ b/src/test/compile-fail/issue-38954.rs
@@ -0,0 +1,16 @@
+// 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)]
+
+fn _test(ref _p: str) {}
+
+#[rustc_error]
+fn main() { } //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-39362.rs b/src/test/compile-fail/issue-39362.rs
new file mode 100644
index 00000000000..9d8abbfc65d
--- /dev/null
+++ b/src/test/compile-fail/issue-39362.rs
@@ -0,0 +1,28 @@
+// 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.
+
+enum Foo {
+    Bar { bar: Bar, id: usize }
+}
+
+enum Bar {
+    A, B, C, D, E, F
+}
+
+fn test(f: Foo) {
+    match f {
+        //~^ ERROR non-exhaustive patterns
+        //~| patterns
+        Foo::Bar { bar: Bar::A, .. } => (),
+        Foo::Bar { bar: Bar::B, .. } => (),
+    }
+}
+
+fn main() {}