about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2017-11-16 10:05:06 +0100
committerGitHub <noreply@github.com>2017-11-16 10:05:06 +0100
commitb09af7064edfa7aa19cdc474a7beace88f98e2a8 (patch)
treedc6ba0dee15f9296cd96f26c53a5aafaa0d519aa
parent8debe610ee91ad544ec65d38e4a89e69bdac8705 (diff)
parent9338b4903aa3696dcba77d0719675a74049e47a9 (diff)
Rollup merge of #46005 - GuillaumeGomez:short-unstable, r=nrc
Set short-message feature unstable

Fixes #45995.

r? @nrc
-rw-r--r--src/librustc/session/config.rs11
-rw-r--r--src/test/ui/short-error-format.rs2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index 3f53c89c9d6..8b55d64c6c6 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -1471,8 +1471,15 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
             Some("human") => ErrorOutputType::HumanReadable(color),
             Some("json")  => ErrorOutputType::Json(false),
             Some("pretty-json") => ErrorOutputType::Json(true),
-            Some("short") => ErrorOutputType::Short(color),
-
+            Some("short") => {
+                if nightly_options::is_unstable_enabled(matches) {
+                    ErrorOutputType::Short(color)
+                } else {
+                    early_error(ErrorOutputType::default(),
+                                &format!("the `-Z unstable-options` flag must also be passed to \
+                                          enable the short error message option"));
+                }
+            }
             None => ErrorOutputType::HumanReadable(color),
 
             Some(arg) => {
diff --git a/src/test/ui/short-error-format.rs b/src/test/ui/short-error-format.rs
index 3e6802c51c3..ecce824ca17 100644
--- a/src/test/ui/short-error-format.rs
+++ b/src/test/ui/short-error-format.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// compile-flags: --error-format=short
+// compile-flags: --error-format=short -Zunstable-options
 
 fn foo(_: u32) {}