diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2016-01-05 14:35:22 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2016-01-15 10:24:12 +1300 |
| commit | 11dcb48c6a99e84952de3b7d5c1f6928d7b05867 (patch) | |
| tree | 05e225d4e6627ca75b4b59ad23808189c892e667 | |
| parent | b976d9e6660c16f4a1d5a28b11afa7ccb4f75da6 (diff) | |
| download | rust-11dcb48c6a99e84952de3b7d5c1f6928d7b05867.tar.gz rust-11dcb48c6a99e84952de3b7d5c1f6928d7b05867.zip | |
Add a test
And fix bustage in make check
| -rw-r--r-- | src/librustdoc/core.rs | 10 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/test.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/errors/json.rs | 2 | ||||
| -rw-r--r-- | src/test/run-make/execution-engine/test.rs | 2 | ||||
| -rw-r--r-- | src/test/run-make/json-errors/Makefile | 7 | ||||
| -rw-r--r-- | src/test/run-make/json-errors/foo.rs | 15 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/compiler-calls.rs | 2 |
8 files changed, 39 insertions, 16 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index d57d1bcd92d..a7fd170b91c 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -118,11 +118,11 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs, }; 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, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ffda261c24f..dce537fe9d2 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -50,6 +50,7 @@ extern crate serialize as rustc_serialize; // used by deriving 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}; @@ -62,7 +63,7 @@ use externalfiles::ExternalHtml; 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; @@ -225,7 +226,7 @@ pub fn main_args(args: &[String]) -> isize { 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, @@ -360,7 +361,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche // 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"); diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 7aa97d3652f..d7d30f065bf 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -73,11 +73,11 @@ pub fn run(input: &str, }; 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, diff --git a/src/libsyntax/errors/json.rs b/src/libsyntax/errors/json.rs index 0b8da7a09b1..713190ef419 100644 --- a/src/libsyntax/errors/json.rs +++ b/src/libsyntax/errors/json.rs @@ -131,7 +131,7 @@ impl<'a> Diagnostic<'a> { je: &JsonEmitter) -> Diagnostic<'a> { Diagnostic { - msg: msg, + message: msg, code: None, level: level.to_str(), span: Some(DiagnosticSpan::from_render_span(span, je)), diff --git a/src/test/run-make/execution-engine/test.rs b/src/test/run-make/execution-engine/test.rs index 928f2f996a0..dc409f393a8 100644 --- a/src/test/run-make/execution-engine/test.rs +++ b/src/test/run-make/execution-engine/test.rs @@ -195,7 +195,7 @@ fn build_exec_options(sysroot: PathBuf) -> Options { 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]; diff --git a/src/test/run-make/json-errors/Makefile b/src/test/run-make/json-errors/Makefile new file mode 100644 index 00000000000..2c1eae81150 --- /dev/null +++ b/src/test/run-make/json-errors/Makefile @@ -0,0 +1,7 @@ +-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 diff --git a/src/test/run-make/json-errors/foo.rs b/src/test/run-make/json-errors/foo.rs new file mode 100644 index 00000000000..9a6f4ad8359 --- /dev/null +++ b/src/test/run-make/json-errors/foo.rs @@ -0,0 +1,15 @@ +// 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; +} diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index e3eeeb86356..56481dc646a 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -35,7 +35,7 @@ impl<'a> CompilerCalls<'a> for TestCalls { fn early_callback(&mut self, _: &getopts::Matches, _: &diagnostics::registry::Registry, - _: errors::emitter::ColorConfig) + _: config::ErrorOutputType) -> Compilation { self.count *= 2; Compilation::Continue |
