about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-06-21 10:40:15 -0400
committerGitHub <noreply@github.com>2017-06-21 10:40:15 -0400
commitd33e2c5181488c15b14a48bd84dec8b28049dd33 (patch)
tree57f627cb4bed95e8643337472050d072fe67f657 /src/test/compile-fail
parent292fcc880fb851d0d582c0bc5a266c77b104fd8b (diff)
parent2bec12f03695792998dbbb79bcee02ecfe0cf8f1 (diff)
downloadrust-d33e2c5181488c15b14a48bd84dec8b28049dd33.tar.gz
rust-d33e2c5181488c15b14a48bd84dec8b28049dd33.zip
Rollup merge of #42620 - wesleywiser:compile_error, r=brson
Add compile_error!

Related to #40872
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/compile_error_macro.rs15
-rw-r--r--src/test/compile-fail/feature-gate-compile_error.rs13
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/compile-fail/compile_error_macro.rs b/src/test/compile-fail/compile_error_macro.rs
new file mode 100644
index 00000000000..2a2c3fd8092
--- /dev/null
+++ b/src/test/compile-fail/compile_error_macro.rs
@@ -0,0 +1,15 @@
+// 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(compile_error)]
+
+fn main() {
+    compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message
+}
diff --git a/src/test/compile-fail/feature-gate-compile_error.rs b/src/test/compile-fail/feature-gate-compile_error.rs
new file mode 100644
index 00000000000..545c6852961
--- /dev/null
+++ b/src/test/compile-fail/feature-gate-compile_error.rs
@@ -0,0 +1,13 @@
+// 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.
+
+fn main() {
+    compile_error!("test"); //~ ERROR: `compile_error` is not stable enough
+}