Rollup merge of #49546 - GuillaumeGomez:stabilize-short-error-format, r=oli-obk

Stabilize short error format

r? @oli-obk

Added in https://github.com/rust-lang/rust/pull/44636
This commit is contained in:
Guillaume Gomez 2018-05-31 22:17:09 +02:00 committed by GitHub
commit 0345dac0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 17 deletions

View File

@ -1799,19 +1799,7 @@ pub fn build_session_options_and_crate_config(
Some("human") => ErrorOutputType::HumanReadable(color), Some("human") => ErrorOutputType::HumanReadable(color),
Some("json") => ErrorOutputType::Json(false), Some("json") => ErrorOutputType::Json(false),
Some("pretty-json") => ErrorOutputType::Json(true), Some("pretty-json") => ErrorOutputType::Json(true),
Some("short") => { Some("short") => ErrorOutputType::Short(color),
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), None => ErrorOutputType::HumanReadable(color),
Some(arg) => early_error( Some(arg) => early_error(

View File

@ -1047,7 +1047,7 @@ fn emit_message_default(&mut self,
} }
} else { } else {
buffer.prepend(0, buffer.prepend(0,
&format!("{}:{}:{} - ", &format!("{}:{}:{}: ",
loc.file.name, loc.file.name,
cm.doctest_offset_line(loc.line), cm.doctest_offset_line(loc.line),
loc.col.0 + 1), loc.col.0 + 1),

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
// compile-flags: --error-format=short -Zunstable-options // compile-flags: --error-format=short
fn foo(_: u32) {} fn foo(_: u32) {}

View File

@ -1,3 +1,3 @@
$DIR/short-error-format.rs:16:9 - error[E0308]: mismatched types $DIR/short-error-format.rs:16:9: error[E0308]: mismatched types
$DIR/short-error-format.rs:18:7 - error[E0599]: no method named `salut` found for type `u32` in the current scope $DIR/short-error-format.rs:18:7: error[E0599]: no method named `salut` found for type `u32` in the current scope
error: aborting due to 2 previous errors error: aborting due to 2 previous errors