};
let codemap = Rc::new(codemap::CodeMap::new());
- let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
- None,
- true,
- false,
- codemap.clone());
+ let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
+ None,
+ true,
+ false,
+ codemap.clone());
let cstore = Rc::new(CStore::new(token::get_ident_interner()));
let sess = session::build_session_(sessopts, cpath, diagnostic_handler,
use std::cell::RefCell;
use std::collections::HashMap;
+use std::default::Default;
use std::env;
use std::fs::File;
use std::io::{self, Read, Write};
use serialize::Decodable;
use serialize::json::{self, Json};
use rustc::session::search_paths::SearchPaths;
-use syntax::errors::emitter::ColorConfig;
+use rustc::session::config::ErrorOutputType;
// reexported from `clean` so it can be easily updated with the mod itself
pub use clean::SCHEMA_VERSION;
let mut libs = SearchPaths::new();
for s in &matches.opt_strs("L") {
- libs.add_path(s, ColorConfig::Auto);
+ libs.add_path(s, ErrorOutputType::default());
}
let externs = match parse_externs(&matches) {
Ok(ex) => ex,
// First, parse the crate and extract all relevant information.
let mut paths = SearchPaths::new();
for s in &matches.opt_strs("L") {
- paths.add_path(s, ColorConfig::Auto);
+ paths.add_path(s, ErrorOutputType::default());
}
let cfgs = matches.opt_strs("cfg");
let triple = matches.opt_str("target");
};
let codemap = Rc::new(CodeMap::new());
- let diagnostic_handler = errors::Handler::new(ColorConfig::Auto,
- None,
- true,
- false,
- codemap.clone());
+ let diagnostic_handler = errors::Handler::with_tty_emitter(ColorConfig::Auto,
+ None,
+ true,
+ false,
+ codemap.clone());
let cstore = Rc::new(CStore::new(token::get_ident_interner()));
let sess = session::build_session_(sessopts,
je: &JsonEmitter)
-> Diagnostic<'a> {
Diagnostic {
- msg: msg,
+ message: msg,
code: None,
level: level.to_str(),
span: Some(DiagnosticSpan::from_render_span(span, je)),
opts.maybe_sysroot = Some(sysroot);
// Prefer faster build time
- opts.optimize = config::No;
+ opts.optimize = config::OptLevel::No;
// Don't require a `main` function
opts.crate_types = vec![config::CrateTypeDylib];
--- /dev/null
+-include ../tools.mk
+
+all:
+ cp foo.rs $(TMPDIR)
+ cd $(TMPDIR)
+ $(RUSTC) -Z unstable-options --output=json foo.rs 2>foo.log || true
+ grep -q '{"message":"unresolved name `y`","code":{"code":"E0425","explanation":"\\nAn unresolved name was used. Example of erroneous codes.*"},"level":"error","span":{"file_name":"foo.rs","byte_start":523,"byte_end":524,"line_start":14,"line_end":14,"column_start":18,"column_end":19},"children":\[\]}' foo.log
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+fn main() {
+ let x = 42 + y;
+}
fn early_callback(&mut self,
_: &getopts::Matches,
_: &diagnostics::registry::Registry,
- _: errors::emitter::ColorConfig)
+ _: config::ErrorOutputType)
-> Compilation {
self.count *= 2;
Compilation::Continue