Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ use std::cell::{Cell, RefCell};
use std::char::from_u32;
use std::fmt;
use syntax::ast;
use syntax::errors::DiagnosticBuilder;
use syntax::errors::{DiagnosticBuilder, check_old_skool};
use syntax::codemap::{self, Pos, Span};
use syntax::parse::token;
use syntax::ptr::P;
Expand Down Expand Up @@ -554,7 +554,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
"{}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, what I was trying to say before was that if we wanted to have something more like the old output, we could remove the modification below and instead change this line to:

let message = if check_old_skool() {
    format("{} ({})", trace.origin, terr)
} else {
    format("{}", trace.origin)
};
let mut err = struct_span_err!(..., "{}", message);

But I guess I'm ok either way.

trace.origin);

if !is_simple_error {
if !is_simple_error || check_old_skool() {
err = err.note_expected_found(&"type", &expected, &found);
}

Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/errors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,13 @@ pub fn expect<T, M>(diag: &Handler, opt: Option<T>, msg: M) -> T where
///
/// FIXME(#33240)
#[cfg(not(test))]
fn check_old_skool() -> bool {
pub fn check_old_skool() -> bool {
use std::env;
env::var("RUST_NEW_ERROR_FORMAT").is_err()
}

/// For unit tests, use the new format.
#[cfg(test)]
fn check_old_skool() -> bool {
pub fn check_old_skool() -> bool {
false
}