]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/session/config.rs
Add new error-format value to use annotate-snippet output
[rust.git] / src / librustc / session / config.rs
index d8efa17defe3d06e6bed593c225a2f65a89548ff..6a35906d20c2f531dbd9a011d3c74a0652c2523b 100644 (file)
@@ -2002,6 +2002,9 @@ pub fn build_session_options_and_crate_config(
         match matches.opt_str("error-format").as_ref().map(|s| &s[..]) {
             None |
             Some("human") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Default(color)),
+            Some("human-annotate-rs") => {
+                ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(color))
+            },
             Some("json") => ErrorOutputType::Json { pretty: false, json_rendered },
             Some("pretty-json") => ErrorOutputType::Json { pretty: true, json_rendered },
             Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short(color)),
@@ -2038,6 +2041,13 @@ pub fn build_session_options_and_crate_config(
                 "--error-format=pretty-json is unstable",
             );
         }
+        if let ErrorOutputType::HumanReadable(HumanReadableErrorType::AnnotateRs(_)) =
+            error_format {
+            early_error(
+                ErrorOutputType::Json { pretty: false, json_rendered },
+                "--error-format=human-annotate-rs is unstable",
+            );
+        }
     }
 
     if debugging_opts.pgo_gen.enabled() && debugging_opts.pgo_use.is_some() {