Skip to content

Commit fad4f32

Browse files
author
Jonathan Turner
committed
Turn on new errors, json mode. Remove duplicate unicode test
1 parent 42903d9 commit fad4f32

File tree

18 files changed

+29
-595
lines changed

18 files changed

+29
-595
lines changed

src/librustc/infer/error_reporting.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use syntax::ast;
9494
use syntax::parse::token;
9595
use syntax::ptr::P;
9696
use syntax_pos::{self, Pos, Span};
97-
use errors::{DiagnosticBuilder, check_old_school};
97+
use errors::DiagnosticBuilder;
9898

9999
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
100100
pub fn note_and_explain_region(self,
@@ -541,25 +541,19 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
541541

542542
let span = origin.span();
543543

544-
let mut is_simple_error = false;
545-
546544
if let Some((expected, found)) = expected_found {
547-
is_simple_error = if let &TypeError::Sorts(ref values) = terr {
545+
let is_simple_error = if let &TypeError::Sorts(ref values) = terr {
548546
values.expected.is_primitive() && values.found.is_primitive()
549547
} else {
550548
false
551549
};
552550

553-
if !is_simple_error || check_old_school() {
551+
if !is_simple_error {
554552
diag.note_expected_found(&"type", &expected, &found);
555553
}
556554
}
557555

558-
if !is_simple_error && check_old_school() {
559-
diag.span_note(span, &format!("{}", terr));
560-
} else {
561-
diag.span_label(span, &terr);
562-
}
556+
diag.span_label(span, &terr);
563557

564558
self.note_error_origin(diag, &origin);
565559
self.check_and_note_conflicting_crates(diag, terr, span);

src/librustc/session/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
10551055
"NAME=PATH"),
10561056
opt::opt_s("", "sysroot", "Override the system root", "PATH"),
10571057
opt::multi_ubnr("Z", "", "Set internal debugging options", "FLAG"),
1058-
opt::opt_ubnr("", "error-format",
1058+
opt::opt_s("", "error-format",
10591059
"How errors and other messages are produced",
10601060
"human|json"),
10611061
opt::opt_s("", "color", "Configure coloring of output:

src/librustc/session/mod.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use mir::transform as mir_pass;
2323
use syntax::ast::{NodeId, Name};
2424
use errors::{self, DiagnosticBuilder};
2525
use errors::emitter::{Emitter, EmitterWriter};
26-
use errors::snippet::FormatMode;
2726
use syntax::json::JsonEmitter;
2827
use syntax::feature_gate;
2928
use syntax::parse;
@@ -369,9 +368,7 @@ pub fn build_session_with_codemap(sopts: config::Options,
369368
let emitter: Box<Emitter> = match sopts.error_format {
370369
config::ErrorOutputType::HumanReadable(color_config) => {
371370
Box::new(EmitterWriter::stderr(color_config,
372-
Some(registry),
373-
Some(codemap.clone()),
374-
errors::snippet::FormatMode::EnvironmentSelected))
371+
Some(codemap.clone())))
375372
}
376373
config::ErrorOutputType::Json => {
377374
Box::new(JsonEmitter::stderr(Some(registry), codemap.clone()))
@@ -509,9 +506,7 @@ pub fn early_error(output: config::ErrorOutputType, msg: &str) -> ! {
509506
let emitter: Box<Emitter> = match output {
510507
config::ErrorOutputType::HumanReadable(color_config) => {
511508
Box::new(EmitterWriter::stderr(color_config,
512-
None,
513-
None,
514-
FormatMode::EnvironmentSelected))
509+
None))
515510
}
516511
config::ErrorOutputType::Json => Box::new(JsonEmitter::basic()),
517512
};
@@ -524,9 +519,7 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) {
524519
let emitter: Box<Emitter> = match output {
525520
config::ErrorOutputType::HumanReadable(color_config) => {
526521
Box::new(EmitterWriter::stderr(color_config,
527-
None,
528-
None,
529-
FormatMode::EnvironmentSelected))
522+
None))
530523
}
531524
config::ErrorOutputType::Json => Box::new(JsonEmitter::basic()),
532525
};

src/librustc_const_eval/eval.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use std::cmp::Ordering;
4444
use std::collections::hash_map::Entry::Vacant;
4545

4646
use rustc_const_math::*;
47-
use rustc_errors::{DiagnosticBuilder, check_old_school};
47+
use rustc_errors::DiagnosticBuilder;
4848

4949
macro_rules! math {
5050
($e:expr, $op:expr) => {
@@ -378,11 +378,7 @@ pub fn note_const_eval_err<'a, 'tcx>(
378378
{
379379
match err.description() {
380380
ConstEvalErrDescription::Simple(message) => {
381-
if check_old_school() {
382-
diag.note(&message);
383-
} else {
384-
diag.span_label(err.span, &message);
385-
}
381+
diag.span_label(err.span, &message);
386382
}
387383
}
388384

src/librustc_driver/lib.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ use syntax::feature_gate::{GatedCfg, UnstableFeatures};
100100
use syntax::parse::{self, PResult};
101101
use syntax_pos::MultiSpan;
102102
use errors::emitter::Emitter;
103-
use errors::snippet::FormatMode;
104103

105104
#[cfg(test)]
106105
pub mod test;
@@ -141,9 +140,7 @@ pub fn run(args: Vec<String>) -> isize {
141140
None => {
142141
let emitter =
143142
errors::emitter::EmitterWriter::stderr(errors::ColorConfig::Auto,
144-
None,
145-
None,
146-
FormatMode::EnvironmentSelected);
143+
None);
147144
let handler = errors::Handler::with_emitter(true, false, Box::new(emitter));
148145
handler.emit(&MultiSpan::new(),
149146
&abort_msg(err_count),
@@ -381,10 +378,7 @@ fn check_cfg(sopts: &config::Options,
381378
output: ErrorOutputType) {
382379
let emitter: Box<Emitter> = match output {
383380
config::ErrorOutputType::HumanReadable(color_config) => {
384-
Box::new(errors::emitter::EmitterWriter::stderr(color_config,
385-
None,
386-
None,
387-
FormatMode::EnvironmentSelected))
381+
Box::new(errors::emitter::EmitterWriter::stderr(color_config, None))
388382
}
389383
config::ErrorOutputType::Json => Box::new(json::JsonEmitter::basic()),
390384
};
@@ -1050,10 +1044,7 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) {
10501044
// Thread panicked without emitting a fatal diagnostic
10511045
if !value.is::<errors::FatalError>() {
10521046
let emitter =
1053-
Box::new(errors::emitter::EmitterWriter::stderr(errors::ColorConfig::Auto,
1054-
None,
1055-
None,
1056-
FormatMode::EnvironmentSelected));
1047+
Box::new(errors::emitter::EmitterWriter::stderr(errors::ColorConfig::Auto, None));
10571048
let handler = errors::Handler::with_emitter(true, false, emitter);
10581049

10591050
// a .span_bug or .bug call has already printed what

0 commit comments

Comments
 (0)